Error Using textscan Invalid fid
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
i have following mistaker in the following part of my Matlab code. The Mistake ist unter de Code separate with dashes. Does someone please know how i can solve the problem?
26 formatSpec = '%*s%s%[^\n\r]';
28 fileID = fopen(filename,'r');
29 dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'MultipleDelimsAsOne', 1, 'ReturnOnError', 0);
30 status = fclose(fileID);
------------------------------------------------------------------------------------------------------------------
??? Error using ==> textscan
Invalid fid.
Error in ==> fetchQOI at 29
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'MultipleDelimsAsOne', 1, 'ReturnOnError', 0);
Error in ==> read_QOI at 6
motor.fem.results.P_mech = fetchQOI(motor.fem, 'Pmech'); % mean(Pmech(N_Steps/2+1:end));
Error in ==> slottedMachineFEM at 38
motor = read_QOI(motor);
1 comentario
Stephen23
el 22 de Feb. de 2024
Editada: Stephen23
el 22 de Feb. de 2024
"Does someone please know how i can solve the problem?"
FOPEN a file that exists.
Most commonly the filename is incorrect or the file does not exist in the provided location. Use the 2nd output argument to get information on why FOPEN could not open any file:
[fileID,msg] = fopen(filename,'r');
assert(fileID>0,'%s',msg)
Did you provide the filename with an absolute/relative filepath?
Respuestas (0)
Ver también
Categorías
Más información sobre Low-Level File I/O en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!