I have a folder of .csv files i'd like to process as a batch, meaning perform analysis on each file individually. Here is the code to open the files, that i found. I'm getting an error i don't understand.
myFolder = 'B:\Projects\Concert\OfflineWarpGauge\FF_Data\Day1';% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isdir(myFolder) errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder); uiwait(warndlg(errorMessage)); return;end% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.csv'); % Change to whatever pattern you need.
theFiles = dir(filePattern);for k = 1 : length(theFiles) baseFileName = theFiles(k).name; fullFileName = fullfile(myFolder, baseFileName); fprintf(1, 'Now reading %s\n', fullFileName);endError Message:Function 'subsindex' is not defined for values of class 'struct'.Error in BatchProcessFiles (line 13)for k = 1 : length(theFiles)
Best Answer