フィルターのクリア

How do I create an array from one field of an array of structs?

1 回表示 (過去 30 日間)
Sam Da
Sam Da 2011 年 2 月 12 日
I have an array of structs.
Each struct has following: name (string) value (double)
I want to create an array of names from names in each struct.
E.g. if I have a an array of structs called DateStruct I can do the following for i=1:25 NameArray(i) = DateStruct(i).name; end
But I want to achieve this through something like: NameArray = DateStruct(1:end).name;
When I do the above the NameArray is just 1x1 and prints only the first name.

採用された回答

Walter Roberson
Walter Roberson 2011 年 2 月 12 日
NameArray = {DateStruct.name}

その他の回答 (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