フィルターのクリア

how to read data in 1*3 struct for one filed directly?

1 回表示 (過去 30 日間)
Xiaodi
Xiaodi 2017 年 9 月 8 日
コメント済み: Stephen23 2017 年 9 月 8 日
Hi, I have a struct and the data,
mystruct = struct([]);
mystruct(1).a = 1;
mystruct(2).a = 2;
mystruct(3).a = 3;
how can I read the data of a directly without using a loop, with a loop man can du it like
for i = 1:length(mystruct)
value_a(i) = mysruct(i).a;
end
than I get
value_a = [1 2 3];
maybe man can read it directly with a special syntax.
Thanks forward!!
  1 件のコメント
Stephen23
Stephen23 2017 年 9 月 8 日
"maybe man can read it directly with a special syntax."
Yes you can! Read this to know how and why:

サインインしてコメントする。

採用された回答

KSSV
KSSV 2017 年 9 月 8 日
iwant = [mystruct.a]
  1 件のコメント
Xiaodi
Xiaodi 2017 年 9 月 8 日
Thank you, it is very good!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by