B = structfun(fun, S)
B = structfun(fun, S, 'UniformOutput', tf)
| Parameter | Description |
|---|---|
| fun | function handle applied to each field value. |
| S | scalar structure. |
| tf | 'UniformOutput' flag: true (default) or false. |
| Parameter | Description |
|---|---|
| B | column vector (uniform output) or structure (non-uniform output). |
structfun(fun, S) applies fun to each field of the scalar structure S and returns the results as a column vector.
With 'UniformOutput' set to false, the results are returned in a structure with the same fields as S.
s.a = 1; s.b = 2; s.c = 3;
structfun(@(x) x * 2, s)
| Version | Description |
|---|---|
| 2.0.0 | initial version |