| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
S = substruct(type1, subs1, type2, subs2, ...)
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).
S |
struct with these fields:
|
Call subsref with arguments equivalent to the syntax:
B = A(3,5).field;
where A is an object of a class that implements a subsref method
Use substruct to form the input struct, S:
S = substruct('()',{3,5},'.','field');
Call the class method:
B = subsref(A,S);
The struct created by substruct in this example contains:
S(1)
ans =
type: '()'
subs: {[3] [5]}
S(2)
ans =
type: '.'
subs: 'field'
![]() | subsref | subvolume | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |