フィルターのクリア

how to loop over the structure fields and get the type of data ?!

733 ビュー (過去 30 日間)
Ano
Ano 2017 年 5 月 22 日
回答済み: James Tursa 2017 年 5 月 23 日
hello! I would like to loop over the fields of a structure and get the type of data for each field, so I can do further manipulation if a field is a matrix , how can I implement this into matlab ?? thank you very much !

採用された回答

James Tursa
James Tursa 2017 年 5 月 23 日
You could loop over the fieldnames, e.g.
fn = fieldnames(mystruct);
for k=1:numel(fn)
if( isnumeric(mystruct.(fn{k})) )
% do stuff
end
end

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