How can I have my code process multiple csv files in a folder without me having to select the file each time?
4 views (last 30 days)
Show older comments
I want to batch process multiple .csv files in a folder and then save them as new files. How do I setup a code so that Matlab automatically runs through the selected folder, processes the first file, saves the first file and then moves onto the next one until all the files are done?
[filename,pathname] = uigetfile( {'*.*', 'All Files (*.*)'}, 'Select all file for processing', 'Multiselect', 'on');
path=char(pathname);
number_of_files_selected = size(filename,2);
trial=importdata([path,filename],',');
AllData=trial.data;
TimeData=AllData(1:end,1);
%TimeData1=TimeData1'
%TimeData=TimeData1(ones(620000,12));
TRIALEMGData=AllData(:,2:13);
[samples,channels] = size(AllData);
filelist=filename';
this is what my code for selecting the file looks like. At the moment I am only selecting one file to process at a time and it takes very long to do this. Would really appreciate the help!
0 Comments
Answers (1)
Image Analyst
on 15 May 2018
Two code samples are shown inthe FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
0 Comments
See Also
Categories
Find more on Introduction to Installation and Licensing 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!