I have a script saved in a certain location but it needs to process multiple csv files in a different location. I keep getting an error saying the file is not found when it tries to do the csvread
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
sal135
am 15 Dez. 2016
Beantwortet: David Barry
am 15 Dez. 2016
folder= 'H:\Matlab\CSV\Processed_csv_Type3\Processed_csv_Type4';
if directory(k).isdir
data=fullfile(folder,'*.csv');
directory=dir(data);
for k= 1:length(directory)
baseFilename = directory(k).name;
fullFilename = fullfile (folder,baseFilename);
for i=1:length(baseFilename)
m{k}=csvread(directory(k).name); % put files into cell array
%process files
%%%%Error Message:
Error using csvread (line 37) File not found.
Error in mlap_convert (line 165) m{k}=csvread(directory(k).name); % put files into cell array
0 Kommentare
Akzeptierte Antwort
David Barry
am 15 Dez. 2016
Why are you looping over the length of baseFileName?
for i=1:length(baseFilename)
Should you not just delete that loop and do?
m{k}=csvread(fullFilename);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu File Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!