フィルターのクリア

Variable for a matrix

4 ビュー (過去 30 日間)
Damith
Damith 2014 年 5 月 20 日
コメント済み: Damith 2014 年 5 月 20 日
Hi,
I have to find mean from Trans1WW to Trans39WW. So, how can i make a variable so that I can include in a for loop.
St1_WW_avg=mean(Trans1WW);
Thanks.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 5 月 20 日
編集済み: Azzi Abdelmalek 2014 年 5 月 20 日
for k=1:39
eval(sprintf('St1_WW_avg(%d)=mean(Trans%dWW)',k,k));
end
You shouldn't use all these variables, it's better to used one cell array containing all your variables.Look at
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 5 月 20 日
Look at edited answer
Damith
Damith 2014 年 5 月 20 日
Thanks. it worked.

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

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