subsref
Extract a subset of a collection given an indexing method and range. sub on the value val.
Syntax
subsref(val, sub)
Inputs
- val
- Any valid number.
- sub
- Type: struct
Outputs
- R
- Resulting scalar | vector | matrix
Example
Simple subsref example.
val = [1 2 3; 4 5 6]
idx.type = '()';
idx.subs = {':', 1:2};
subsref (val, idx)
val = [Matrix] 2 x 3
1 2 3
4 5 6
ans = [Matrix] 2 x 2
1 2
4 5