reading multiple .mps files in a loop

2 views (last 30 days)
vishakha nagarajan
vishakha nagarajan on 9 Feb 2022
Commented: Mathieu NOE on 9 Feb 2022
I have about 100 .mps files of raw data and need to process this info(they are all stored in a folder). I want to read each file, extract a specific section of each of the files (from 1:4 coloums), find the maximum value in each of this extracted data (for each file) and store this max data separately. How can I go about this?
Thanks!
  2 Comments
Mathieu NOE
Mathieu NOE on 9 Feb 2022
hello
example for excel files below , adapt to your own needs :
fileDir = pwd;
sheet = 2; % data must be retrieved from sheet #2
S = dir(fullfile(fileDir,'*.xlsx')); % get list of data files in directory
S = natsortfiles(S); % sort file names into natural order (what matlab does not) , see FEX :
%(https://fr.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filename-sort)
for k = 1:length(S)
data = xlsread(fullfile(fileDir, S(k).name),sheet); % or use a structure (S(k).data ) to store the full data structure
% your code here
end

Sign in to comment.

Answers (0)

Categories

Find more on Deployable Archive Creation in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!

Translated by