How can I have my code process multiple csv files in a folder without me having to select the file each time?

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!

Categories

Asked:

on 15 May 2018

Answered:

on 15 May 2018

Community Treasure Hunt

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

Start Hunting!