How to store structure data into an array in loop?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a structure with many fields of different length.I want to store this structure data into an array in a loop.How to solve this issue.
0 件のコメント
回答 (1 件)
Matt J
2013 年 5 月 28 日
As in the following example
>> s.a=1; s.b=[2 3]; %A struct
a: 1
b: [2 3]
>> C=struct2cell(s); [C{:}]
ans =
1 2 3
2 件のコメント
Loretta Laughrey
2018 年 6 月 21 日
編集済み: Loretta Laughrey
2018 年 6 月 21 日
What if I want an array of structures so that:
s(1) = struct(1,[2,3])
s(2) = struct(4,[5,6])
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!