Finding the average of multiple Matrices on multiple files
Show older comments
I am trying to find the average, max and min of matrices piece by piece, not as a whole matrices. I have tried to use a for loop but I think I am too beginner to make it work. I have 7 files, each with their own matrices that I would like to bring in and average them. Any ideas?
Thank you!
1 Comment
Kevin Chng
on 19 Oct 2018
What do you mean piece by piece? column by column?
Answers (1)
madhan ravi
on 19 Oct 2018
Edited: madhan ravi
on 19 Oct 2018
An example:
folder='E:\Matlab';
filetype='*.xls'; % or xlsx , specify the correct format of your files
f=fullfile(folder,filetype);
d=dir(f);
for k=1:numel(d);
data{k}=xlsread(fullfile(folder,d(k).name));
Average{k}=mean{k};
end
Categories
Find more on Loops and Conditional Statements 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!