フィルターのクリア

Mean of several variables

5 ビュー (過去 30 日間)
lukbe
lukbe 2016 年 3 月 15 日
回答済み: lukbe 2016 年 3 月 15 日
Hello i have problem. How I can solve mean of sever variables? I have variables from test1 to test100, these variables are matrices 315x573.
I know that mean is for example: pokus=mean(test1(:))
And how use for cycle to replace number of variable and make mean these variable?
When i use:
for i=1:100
pokus(i,:)=mean(eval(['test' num2str(i)]),1);
% prumer=mean(pokus,2);
end
I receive error:
Subscripted assignment dimension mismatch.
  1 件のコメント
Image Analyst
Image Analyst 2016 年 3 月 15 日
Somehow you got yourself into a real mess. How on earth did you have 100 variables names test1 through test100? I would try to avoid that in the first place. If you put the hundred matrices into a single 3D array instead, it would be so easy - a single line of code. No for loop and no (hated) eval function.

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

回答 (2 件)

Stalin Samuel
Stalin Samuel 2016 年 3 月 15 日
Your code is correct .Kindly verify size of "pokus" if you initialized

lukbe
lukbe 2016 年 3 月 15 日
I have found error, one variable have different dimension. Now it work fine :)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by