Mean of an array with array elements

1 次查看(过去 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 CenterFile Exchange 中查找有关 Testing Frameworks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by