standard deviation and mean across specific columns of a 3D matrix
5 views (last 30 days)
Show older comments
I have multiple excel files that I need to analyze. The data is voltage vs time, and the size of each file is 700x216 double. Each file has multiple tests and multiple trials for each test. I need to average the trials for each test across rows. Then I need to compare the averaged data between tests(files). I can import all the files I need with a for loop, construct a 3D matrix, and get the mean of all values across tests. Is there a way to average across specific rows for all tests and run statistics such as standard deviation across the averaged data in a 3D matrix? Is a 3D matrix the best approach for this?
% 3D matrix
mtx = cat(3,(data{:,1}));
%mean of matrix
Mmtx = mean(mtx,3);
% tried this but only gave me the average of the first data set
MmtxT1 = mean(mtx(:,[2 3 4 5]),2);
2 Comments
dpb
on 7 Aug 2020
" Is a 3D matrix the best approach...?"
Possibly not...it would help to know the layout of the 2D files and over what parts are to be averaged. That you have multiple tests and trials combined in the one file means need to be able to reference them -- another structure built around that arrangement could possibly work more effectively.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Spreadsheets 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!