Create a new row in a loop

1 回表示 (過去 30 日間)
Jasper Mark
Jasper Mark 2021 年 1 月 7 日
回答済み: Jasper Mark 2021 年 1 月 11 日
Please forgive me if this is a basic question. I would like to create a new row as the value for freq increases by one to the struct coherence that is created.
for freq = 10; % Would change to freq=10:50
coherence = {};
for coherence_index = 1:length(three_d_trials)
coherence{coherence_index} = cmc_coherence(three_d_trials{coherence_index}, freq, 1000);
coherence{coherence_index} = squeeze(coherence{coherence_index});
end
end

採用された回答

dpb
dpb 2021 年 1 月 7 日
f1=10; f2=50;
coherence=cell(numel(f1:f2),numel(three_d_trials));
j=0;
for freq=f1:f2
j=j+1;
for coherence_index = 1:length(three_d_trials)
coherence{j,coherence_index} = squeeze(cmc_coherence(three_d_trials{coherence_index}, freq, 1000));
end
end
What's the squeeze for???

その他の回答 (1 件)

Jasper Mark
Jasper Mark 2021 年 1 月 11 日
Thank you so much! The squeeze is to condense the 3-d format of the file into a 2-d array

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by