Mean of an array with array elements

3 ビュー (過去 30 日間)
fadams18
fadams18 2018 年 10 月 23 日
編集済み: madhan ravi 2018 年 10 月 23 日
I have the code below.
rRE_NeNMF_R=[2,2];
rRE_NeNMF_V=[2,2];
rRE_MU_R=[2,2];
rRE_MU_V=[2,2];
rRE_ALS_R=[2,2];
rRE_HALS_R=[2,2];
rRE_PG_R=[2,2];
Data=[rRE_NeNMF_R, rRE_NeNMF_V,rRE_MU_V,rRE_MU_R,rRE_ALS_R,rRE_HALS_R,rRE_PG_R];
Since I want to find the mean of all the elements, i dont want to do them one by one. its too much. is there a way to this? so in effect, i should get somethin like Data=[2,2,2 .....]

回答 (1 件)

madhan ravi
madhan ravi 2018 年 10 月 23 日
編集済み: madhan ravi 2018 年 10 月 23 日
>> rRE_NeNMF_R=[2,2];
rRE_NeNMF_V=[2,2];
rRE_MU_R=[2,2];
rRE_MU_V=[2,2];
rRE_ALS_R=[2,2];
rRE_HALS_R=[2,2];
rRE_PG_R=[2,2];
Data = [rRE_NeNMF_R; rRE_NeNMF_V;rRE_MU_V;rRE_MU_R;rRE_ALS_R;rRE_HALS_R;rRE_PG_R]
Data = mean(Data,2)'
Data =
2 2
2 2
2 2
2 2
2 2
2 2
2 2
Data =
2 2 2 2 2 2 2
>>
  1 件のコメント
madhan ravi
madhan ravi 2018 年 10 月 23 日
編集済み: madhan ravi 2018 年 10 月 23 日
You should replace , with ; and then if you transpose you will get the desired result , try the above now , if it's upto your requirements accept the answer so that other people know the question is solved else let know what's additionally required

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

カテゴリ

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