- •Xregpointer/logical
- •Value arrays are placed into corresponding structure array elements.
- •Isfield, rmfield, deal, substruct, struct2cell, cell2struct.
- •Is the Java class specified by the character string classname.
- •Cell array functions
- •Vector of row sizes (must sum to row) and n is the vector of column
- •Array functions
- •If an error handler is not specified, the error from the call to
- •Value arrays are placed into corresponding structure array elements.
- •Isfield, rmfield, deal, substruct, struct2cell, cell2struct.
- •Identical way.
- •Idivide - Integer division with rounding option.
- •Vertcat - Vertical concatenation [;]
- •Byte manipulation functions.
- •Object oriented programming functions
- •Value arrays are placed into corresponding structure array elements.
- •In a cell array of strings.
- •If a function is called with two objects with an unspecified
- •If the input object does not match the current definition (as defined
- •Information outside the object array into saveable form (so that a
If an error handler is not specified, the error from the call to
FUN will be rethrown.
Examples
To create shortened weekday names from the full names, create a
structure with strings in several fields.
s.f1 = 'Sunday'; s.f2 = 'Monday'; s.f3 = 'Tuesday';
s.f4 = 'Wednesday'; s.f5 = 'Thursday'; s.f6 = 'Friday';
s.f7 = 'Saturday';
shortNames = structfun(@(x) ( x(1:3) ), s, 'UniformOutput', false);
See also cellfun, arrayfun, function_handle, cell2mat, spfun
Reference page in Help browser
doc structfun
Structure functions
<struct> - Create or convert to structure array.
STRUCT Create or convert to structure array.
S = STRUCT('field1',VALUES1,'field2',VALUES2,...) creates a
structure array with the specified fields and values. The value
arrays VALUES1, VALUES2, etc. must be cell arrays of the same
size, scalar cells or single values. Corresponding elements of the
Value arrays are placed into corresponding structure array elements.
The size of the resulting structure is the same size as the value
cell arrays or 1-by-1 if none of the values is a cell.
STRUCT(OBJ) converts the object OBJ into its equivalent
structure. The class information is lost.
STRUCT([]) creates an empty structure.
To create fields that contain cell arrays, place the cell arrays
within a VALUE cell array. For instance,
s = struct('strings',{{'hello','yes'}},'lengths',[5 3])
creates the 1-by-1 structure
s =
strings: {'hello' 'yes'}
lengths: [5 3]
Example
s = struct('type',{'big','little'},'color','red','x',{3 4})
See also isstruct, setfield, getfield, fieldnames, orderfields,
Isfield, rmfield, deal, substruct, struct2cell, cell2struct.
Overloaded methods:
memmapfile/struct
network/struct
SimData/struct
Reference page in Help browser
doc struct
<fieldnames> - Get structure field names.
FIELDNAMES Get structure field names.
NAMES = FIELDNAMES(S) returns a cell array of strings containing
the structure field names associated with the structure s.
NAMES = FIELDNAMES(Obj) returns a cell array of strings containing
the names of the fields in Obj if Obj is a MATLAB object, or the
names of the public fields if Obj is a Java object. MATLAB objects
may override fieldnames and define their own behavior.
NAMES = FIELDNAMES(Obj, '-full') returns a cell array of strings
containing the name, type, attributes, and inheritance of each
field associated with Obj, which is either a MATLAB or a Java object.
See also isfield, getfield, setfield, orderfields, rmfield.
Overloaded methods:
timer/fieldnames
serial/fieldnames
audiorecorder/fieldnames
audioplayer/fieldnames
tscollection/fieldnames
instrument/fieldnames
dioline/fieldnames
digitalio/fieldnames
aochannel/fieldnames
analogoutput/fieldnames
analoginput/fieldnames
aichannel/fieldnames
codistributed/fieldnames
fints/fieldnames
idmodel/fieldnames
idnlmodel/fieldnames
idnlgrey/fieldnames
imaqdevice/fieldnames
imaqchild/fieldnames
iviconfigurationstore/fieldnames
icgroup/fieldnames
icdevice/fieldnames
opcroot/fieldnames
wcgopt/fieldnames
uss/fieldnames
umat/fieldnames
ufrd/fieldnames
robopt/fieldnames
iconnect/fieldnames
dkitopt/fieldnames
atomlist/fieldnames
atom/fieldnames
Reference page in Help browser
doc fieldnames
<getfield> - Get structure field contents.
GETFIELD Get structure field contents.
F = GETFIELD(S,'field') returns the contents of the specified
field. This is equivalent to the syntax F = S.field.
S must be a 1-by-1 structure.
F = GETFIELD(S,{i,j},'field',{k}) is equivalent to the syntax
F = S(i,j).field(k).
In other words, F = GETFIELD(S,sub1,sub2,...) returns the
contents of the structure S using the subscripts or field
references specified in sub1,sub2,etc. Each set of subscripts in
parentheses must be enclosed in a cell array and passed to
GETFIELD as a separate input. Field references are passed as
strings.
Note that if the evaluation of the specified subscripts results
in a comma separated list, then GETFIELD will return the value
corresponding to the first element in the comma separated list.
For improved performance, when getting the value of a simple
field, use dynamic field names.
See also setfield, isfield, fieldnames, orderfields, rmfield.
Overloaded methods:
fints/getfield
vrnode/getfield
Reference page in Help browser
doc getfield
<setfield> - Set structure field contents.
SETFIELD Set structure field contents.
S = SETFIELD(S,'field',V) sets the contents of the specified
field to the value V. This is equivalent to the syntax S.field = V.
S must be a 1-by-1 structure. The changed structure is returned.
S = SETFIELD(S,{i,j},'field',{k},V) is equivalent to the syntax
S(i,j).field(k) = V;
In other words, S = SETFIELD(S,sub1,sub2,...,V) sets the
contents of the structure S to V using the subscripts or field
references specified in sub1,sub2,etc. Each set of subscripts in
parentheses must be enclosed in a cell array and passed to
SETFIELD as a separate input. Field references are passed as
strings.
For improved performance, when setting the value of a simple
field, use dynamic field names.
See also getfield, isfield, fieldnames, orderfields, rmfield.
Overloaded methods:
fints/setfield
vrnode/setfield
Reference page in Help browser
doc setfield
<rmfield> - Remove fields from a structure array.
RMFIELD Remove fields from a structure array.
S = RMFIELD(S,'field') removes the specified field from the
m x n structure array S. The size of input S is preserved.
S = RMFIELD(S,FIELDS) removes more than one field at a time
when FIELDS is a character array or cell array of strings. The
changed structure is returned. The size of input S is preserved.
See also setfield, getfield, isfield, fieldnames.
Overloaded methods:
codistributed/rmfield
fints/rmfield
Reference page in Help browser
doc rmfield
<isfield> - True if field is in structure array.
ISFIELD True if field is in structure array.
ISFIELD(S,FIELD) returns true if the string FIELD is the name of a
field in the structure array S.
TF = ISFIELD(S,FIELDNAMES) returns a logical array, TF, the same size
as the size of the cell array FIELDNAMES. TF contains true for the
elements of FIELDNAMES that are the names of fields in the structure
array S and false otherwise.
NOTE: TF is false when FIELD or FIELDNAMES are empty.
Example:
s = struct('one',1,'two',2);
fields = isfield(s,{'two','pi','One',3.14})
See also getfield, setfield, fieldnames, orderfields, rmfield,
isstruct, struct.
Overloaded methods:
fighandle/isfield
bloomberg/isfield
fints/isfield
Reference page in Help browser
doc isfield
<isstruct> - True for structures.
ISSTRUCT True for structures.
ISSTRUCT(S) returns logical true (1) if S is a structure
and logical false (0) otherwise.
See also struct, isfield, iscell, isnumeric, isobject.
Reference page in Help browser
doc isstruct
<orderfields> - Order fields of a structure array.
ORDERFIELDS Order fields of a structure array.
SNEW = ORDERFIELDS(S1) orders the fields in S1 so the new structure array
SNEW has field names in ASCII dictionary order.
SNEW = ORDERFIELDS(S1, S2) orders the fields in S1 so the new structure
array SNEW has field names in the same order as those in S2. Sl and S2
must have the same fields.
SNEW = ORDERFIELDS(S1, C) orders the fields in S1 so the new structure
array SNEW has field names in the same order as those in the cell array
of field name strings in C. S1 and C must have the same field names.
SNEW = ORDERFIELDS(S1, PERM) orders the fields in S1 so the new structure array SNEW has fieldnames in the order specified by the indices in PERM. If S1 has N fieldnames, the elements of PERM must be a rearrangement of the numbers from 1 to N. This is particularly useful if you have more
than one structure array that you would like to reorder, all in an