Why does this code generate an error?
Mostrar comentarios más antiguos
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 comentarios
Adam
el 5 de Abr. de 2017
What is in fNames when you step through the code in the debugger?
Chaitanya Bade
el 5 de Abr. de 2017
Editada: the cyclist
el 5 de Abr. de 2017
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre MATLAB Report Generator en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!