Take average of multiple matrices
Show older comments
Hello,
I have a variable that contains 5 matrices (6*5) inside it. I want to take the average of these matrices and store it in a 6*5 matrix. I would greatly appreciate it if you could help me with that. I will attach the variable to this post.
Thanks,
Amir
Accepted Answer
More Answers (2)
KSSV
on 8 Apr 2021
load data.mat ;
A = cat(3,phi_BFD_v_sum{:}) ;
iwant = mean(A,3) ;
per isakson
on 8 Apr 2021
Try this
%%
load('data.mat')
num = cat( 3, phi_BFD_v_sum{:} );
avg = mean( num, 3 );
peek
>> avg
avg =
0 0 0 0 0
0.22843 0.60803 0.8 0.70577 0.43885
0.43769 0.8 0.2495 -0.52216 -0.71376
0.61117 0.4325 -0.73741 -0.28474 0.76717
0.7355 -0.24119 -0.45683 0.72973 -0.55882
0.8 -0.74809 0.6222 -0.36164 0.21224
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!