How can I do loop for struct data?
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
I have a data set that consist of a structure , example: data (1x10 struct with 1 field) How can I do loop to read all these data? I want to be able to do a calculation on a specific measurements of each field. Thanks
0 件のコメント
回答 (2 件)
Azzi Abdelmalek
2016 年 4 月 18 日
a=struct('f',num2cell(1:10))
out=[a.f]
6 件のコメント
Riyadh Muttaleb
2016 年 4 月 18 日
編集済み: Riyadh Muttaleb
2016 年 4 月 18 日
Azzi Abdelmalek
2016 年 4 月 18 日
Post an example
Azzi Abdelmalek
2016 年 4 月 18 日
v=num2cell(rand(4))
a=struct('f',v)
%-------------------------
out=reshape([a.f],size(a))
Riyadh Muttaleb
2016 年 4 月 20 日
Azzi Abdelmalek
2016 年 4 月 20 日
suppose you have this matrix
A=[1 2;3 4;5 6]
What operation you want to apply?
Riyadh Muttaleb
2016 年 4 月 21 日
Walter Roberson
2016 年 4 月 19 日
Example:
arrayfun(@(IDX) mean(YourStructArray(IDX).TheField(:)), 1:numel(YourStructArray))
0 件のコメント
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!