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 Center および File ExchangeLow-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