How to loop through structure with words?

1 回表示 (過去 30 日間)
Paul Hinze
Paul Hinze 2021 年 7 月 28 日
コメント済み: Stephen23 2021 年 7 月 28 日
Hi guys,
I would like to systematically change the name in the loop (from BreakingGlass to WhiteNoise) to work in the 6X9 matrix.
My Idea is to do:
reflectance.nhy1.NAME OF SOUND.(:,:)
I need to do
tones = '1'; The 1 is just an example which works, but I need to do this with
tones = 'BreakingGlass', but then the str2num function gives me a NaN back, how can I solve this problem?
finish_tones = str2num(tones)
How can I fill a new name of sound in each iteration?
Thank you for your help!

採用された回答

Fangjun Jiang
Fangjun Jiang 2021 年 7 月 28 日
編集済み: Fangjun Jiang 2021 年 7 月 28 日
fn=fieldnames(reflectance.nhy1);
for k=1:length(fn)
reflectance.nhy1.(fn{k})
end
  1 件のコメント
Paul Hinze
Paul Hinze 2021 年 7 月 28 日
Thank you, now it works

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by