Error using textscan Invalid file identifier. Use fopen to generate a valid file identifier.
2 次查看(过去 30 天)
显示 更早的评论
I'm doing a simulation using MATLAB. There is a python code that reads the plain-text files for model setup and generates text files easy to import by Matlab. The program makes plain-text files containing number of values and a column of values. However, when I run the program in MATLAB the following error occurs:
Error using textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in load_setup>load_word (line 247)
temp=textscan(fid,'%d'); % eat up default '1'
Error in load_setup (line 59)
Model.code=load_word(standard_folder_name,'Model_code');
Error in Simulate (line 57)
[conditions, modes, Model]=load_setup(setup_name, model_name);
I don't know exactly what to do.
3 个评论
dpb
2020-7-16
"what do you mean by fully-qualified filename?"
One that includes the path, not just the file name.
Well, we can't tell from here what the script is doing -- since it didn't test for valid fid on fopen but just let the system error message report, you don't know anything else, specifically.
Set a breakpoint in the script/function and see what gives -- you can add the optional error message return to fhe fopen call and see what the actual error returned was...
Or, if it's a script, maybe they presumed you had already opened the file yourself first??? We simply can't tell.
Also, of course, make sure you're actually running the script (or the script/function itself is running in the location you think--maybe it tries to be clever and does a cd inside to where it thinks the input files should be...
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Standard File Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!