Why does this code generate an error?
Mostra commenti meno recenti
Hi all,
The below code is generating an error :
The code used here is:
%BATCH MODE
files = dir('C:\Users\Deakin Uni\Documents\MATLAB\a');
fNames = {files.name};
%for each file
for k= 1: length(fNames)
% extract file name
fName = ['C:\Users\Deakin Uni\Documents\MATLAB\MAX', fNames{k}];
[XDATA, TIMESTEPS] = importfile(fName);
a1 = XDATA - mean (XDATA);
plot(TIMESTEPS, a1);
[peakvals,peaklocs] = findpeaks(a1, 'minpeakdistance',50, 'minpeakheight', 0.00001);
peaktime = TIMESTEPS(peaklocs);
createfigure4(TIMESTEPS, a1, peaktime, peakvals)
saveas(gcf, 'chaitu.fig')
end
The error here is: Error using xlsread (line 132) XLSREAD unable to open file 'fName'. File 'fName' not found.
Error in importfile (line 36) data = xlsread(workbookFile, sheetName, sprintf('A%d:B%d',startRow(1),endRow(1)));
Thanks in advance
2 Commenti
Adam
il 5 Apr 2017
What is in fNames when you step through the code in the debugger?
Chaitanya Bade
il 5 Apr 2017
Modificato: the cyclist
il 5 Apr 2017
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su MATLAB Report Generator in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!