Main Content

潜艇truct

Create structure argument for潜艇asgnor潜艇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潜艇refor潜艇asgnmethod. Eachtypecharvector 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

S

结构体with these fields:

  • type之一:'.','()', or'{}'

  • 潜艇: subscript values (field name or cell array of index vectors)

Examples

Call潜艇refwith arguments equivalent to the syntax:

B = A(3,5).field;

whereAis an object of a class that implements a潜艇refmethod

Use潜艇tructto form the input结构体,S:

S = substruct('()',{3,5},'.','field');

Call the class method:

B = subsref(A,S);

The结构体created by潜艇tructin this example contains:

disp(S(1)) type: '()' subs: {[3] [5]} disp(S(2)) type: '.' subs: 'field'

Extended Capabilities

Version History

Introduced before R2006a