soa2aos(IN, LCHK)

版本 3.0.0.0 (3.1 KB) 作者: Stefano Gianoli
converts a structure of arrays to a column array of structures
32.0 次下载
更新时间 2016/11/14

查看许可证

SYNTAX:
OUT = soa2aos(IN)
OUT = soa2aos(IN, LCHK)

ARGUMENTS:
IN scalar structure, whose fields are arrays of the classes
'cell', 'numeric' or 'struct' and can be orianted as column, rows
or multidimensional.
LCHK scalar logical, optional input.
true (default) => the length of each field array must be the same.
false => field arrays can have different lengths.
OUT [Nx1] column array of N structures with the same fields of IN,
with scalar values. N is the maxium array length of the input
structure fields. Shorter arrays will results in empty fields in
the OUT structure.

EXAMPLE
IN.fld1 = {'a','b','cd'};
IN.fld2 = {'e';'fg';'123'};
IN.fld3 = [1 2];
IN.fld4 = struct('a',{{'one','two'},2});
OUT = soa2aos(IN, false)

引用格式

Stefano Gianoli (2024). soa2aos(IN, LCHK) (https://www.mathworks.com/matlabcentral/fileexchange/60104-soa2aos-in-lchk), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2016a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
3.0.0.0

If the second optional parameter is true (default) the length of the input fields must be the same, otherwise if false the input fields can have different lengths.

2.0.0.0

Fields in the input structure can be
- numeric, structure or cells
- oriented as row, column or multidimensional
- of different lenghts

1.0.0.0