Is it possible to do a for loop of this code?

Hi,
sigma1cm0 = std(cm0_1); sigma1cmA = std(cmA_1);
sigma1cmq = std(cmq_1); sigma1cmE = std(cmE_1);
The size of cm0/A/q/E its all the same
>> size(cm0_1)
ans =
4 1
all 1 to 3 (three sets, from three different datas: cm0_1,cm0_2,cm0_3 and cmq_1,cmq_2 and so on ) and maybe each letter, as they have 'cm' in common? (0,A,q,E) Thanks

2 件のコメント

Roger Stafford
Roger Stafford 2014 年 12 月 11 日
編集済み: Roger Stafford 2014 年 12 月 11 日
Your computations seem entirely normal, but could you please state your question in more detail. I don't understand what you are asking. In particular what is it you mean by "1 to 3 and maybe each letter? (0,A,q,E)" or "Is it possible to loop this" ?
Andil  Aboubakari
Andil Aboubakari 2014 年 12 月 11 日
編集済み: Andil Aboubakari 2014 年 12 月 11 日
That code is only a third of what it should be. I have another two set which is exactly the same but all the 1 changes to 2 (second set) and then 3.
So I was asking if its possible to avoid the repetition and loop one line through all the four letters three times, roughly like this:
letter={'0';'A';'q';'E'}
for ii=1:3
for jj=1:numel(letter)
sigma(ii)cm(letter(jj))=std(cm(letter(jj)_(ii))
cm(letter(jj)(ii))=max(cm(letter(jj)_(ii))
cm(letter(jj)(ii))=min(cm(letter(jj)_(ii))
end
end
Obviously that not the right way for sure.

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

 採用された回答

dpb
dpb 2014 年 12 月 11 日

1 投票

...if its possible to avoid the repetition and loop one line through all the four letters...
"Possible", yes, but "there be dragons" that way...
for why and alternatives. I think newer doc has a discussion under eval of the topic as well. For this case probably the alternative of dynamically-named structure is good choice.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2014 年 12 月 11 日

編集済み:

2014 年 12 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by