Error Using textscan Invalid fid

조회 수: 3 (최근 30일)
JoeTeg
JoeTeg 2024년 2월 22일
편집: Stephen23 2024년 2월 22일
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
Stephen23
Stephen23 2024년 2월 22일
편집: Stephen23 2024년 2월 22일
"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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

태그

제품


릴리스

R2007b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by