struct
Creates one or more structs with the specified fields and values.
Syntax
R = struct(x1,y1,x2,y2,.....)
Inputs
- x1
- Field name for the resultant struct.
- y1
- Values of x1. If the value in not a single element, then it must be a cell that contains the individual values. All value elements (y1, y2, ...) must have the same dimension.
Outputs
- R
- Resultant struct array.
Examples
R = struct('foo', 1)
R = struct [
foo: 1
]
R = struct('foo', {1,2,3}, 'bar', {'a','b','c'})
R = struct [
Struct array of size 1 x 3 with fields:
bar
foo
]
Comments
a = struct('a', {1,2,3})
b = struct('a', {{1,2,3}})