MATLAB Function Reference | ![]() ![]() |
Create structure argument for subsasgn
or subsref
Syntax
Description
S = substruct(type1,subs1,type2,subs2,...)
creates a structure with the fields required by an overloaded subsref
or subsasgn
method. Each type
string must be one of '.
', '()
', or '{}
'. The corresponding subs
argument must be either a field name (for the '.
' type) or a cell array containing the index vectors (for the '()
' or '{}
' types).
The output S
is a structure array containing the fields:
type
- one of '.
', '()
', or '{}
'
subs
- subscript values (field name or cell array of index vectors)
Examples
To call subsref
with parameters equivalent to the syntax
The structure created by substruct
in this example contains the following.
See Also
![]() | subsref | subvolume | ![]() |