Function x = fieldvaluecascade(1,x_default,struct1,fieldname1,struct2,fieldname2,...)
x = fieldvaluecascade(0,ignored,struct1,fieldname1,struct2,fieldname2,...)
[x,istruct] = fieldvaluecascade(...)
returns the value of the field of the _last_
struct listed in the input arguments, in which
the field exists.
The 3rd, 5th, 7th etc. input arguments contain
struct's. The 4th, 6th, 8th etc. input
arguments contain strings for the respective
field names. Note that the first struct for
which the existance of the field name is
tested, is the _last_ one listed. The tests
continue to the left of the list, until a
struct is encountered which has the mentioned
field name!
The 1st input argument is a boolean whether
a default value is provided. If it is true,
the 2nd input argument, contains a default
return value; otherwise, the second input
argument is ignored and an error is raised
when no struct has the requested field name.
Optional output argument istruct contains
zero when the value of x_default is returned
by x, or K when the field value from the
given k-th struct is returned by x.
(c) 2026 fabien van mook
2026.08.20 release of this file within package "fvm-htab" under GNU GPLv3+