潜艇truct
Create structure argument for潜艇asgn
or潜艇ref
Syntax
S = substruct(type1, subs1, type2, subs2, ...)
Description
S = substruct(type1, subs1, type2, subs2, ...)
creates a structure with the fields required by an overloaded潜艇ref
or潜艇asgn
method. Eachtype
char
vector must be one of'.'
,'()'
, or'{}'
. The corresponding潜艇
argument must be either a field name (for the'.'
type) or a cell array containing the index vectors (for the'()'
or'{}'
types).
Output Arguments
|
|
Examples
Call潜艇ref
with arguments equivalent to the syntax:
B = A(3,5).field;
whereA
is an object of a class that implements a潜艇ref
method
Use潜艇truct
to form the input结构体
,S
:
S = substruct('()',{3,5},'.','field');
Call the class method:
B = subsref(A,S);
The结构体
created by潜艇truct
in this example contains:
disp(S(1)) type: '()' subs: {[3] [5]} disp(S(2)) type: '.' subs: 'field'