Hi,
I have over 2000 csv files and I can read the csv files and store in a cell array. But, all csv files has some text written at the end of the rows (the text is same in all files). How can I delete the text from all files.
Please see the images below. My MATLAB code is shown below.
clear allcd ('C:\Users\Desktop\')myFolder = 'C:\Users\Desktop\Q_gte_10';if ~isdir(myFolder) errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder); uiwait(warndlg(errorMessage)); return;endfilePattern = fullfile(myFolder, '*.csv');csvFiles = dir(filePattern);for k = 1:length(csvFiles) fid(k) = fopen(fullfile(myFolder,csvFiles(k).name)); out{k} = textscan(fid(k),'%s %s %s %s %*[^\n]','delimiter',',','headerlines',1); fclose(fid(k));end
Best Answer