R14SP3
23-22
You can use this stack information to track down the source of an error, or as an input to
the rethrow function. When used with rethrow, MATLAB sets the stack of the rethrown
error to the value contained in the stack input.
isfield Function Supports Cell Arrays; Results Might Differ from Previous
Version
The isfield function now supports cell array input as shown in this example. Check
structure S for any of four possible field names. In this case, only the first is found, so the
first element of the return value is set to true:
S = struct('one', 1, 'two', 2);
fields = isfield(S, {'two', 'pi', 'One', 3.14})
fields =
1 0 0 0
Compatibility Considerations
There might be backward compatibility issues associated with this change if you used
isfield with cell array input in a previous release. In previous releases, although
isfield might have worked with this type of input in certain cases, it was not officially
a supported feature. If you used this previously unsupported syntax in previous releases,
you may see a change in the content and/or size of the return values in this release.
For example, create a structure s with three fields a, b, and c created in that order.
In MATLAB 7.0.4, isfield called with a cell array input returns true if any of the
elements of the cell array matches a field name, and if that element is in the same
position in the cell array as the field is in the structure. This is true for 'c':
isfield(s, {'b'; 'a'; 'c'})
ans =
1
In MATLAB 7.1, isfield returns true for each element in the cell array that matches
a field name, regardless of where the string is positioned in the cell array. This is true for
'a', 'b', and 'c':
isfield(s, {'b'; 'a'; 'c'})
ans =
1
Comments to this Manuals