Mean of an array with array elements

2 views (last 30 days)
fadams18
fadams18 on 23 Oct 2018
Edited: madhan ravi on 23 Oct 2018
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 .....]

Answers (1)

madhan ravi
madhan ravi on 23 Oct 2018
Edited: madhan ravi on 23 Oct 2018
>> 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 Comment
madhan ravi
madhan ravi on 23 Oct 2018
Edited: madhan ravi on 23 Oct 2018
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

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!