Textscan has an error with some file names and not others?
I'm running a long and complex program for data analysis that runs perfectly fine with certain numbered data files but not with others.
When it is unhappy, I get the following error: ??? Error using ==> textscan Invalid file identifier. Use fopen to generate a valid file identifier.
The file names are zs_120.dat and zs_149.dat. I see no reason why 120 is a valid file identifier but 149 is not?
Is there some kind of setting I can change, either in Matlab or on my computer, that will enable it to run properly?
here, NonRephasingC16_120 is the name of the program being used.
The files are also both in the same folder.
Check the second output 'errmsg' in your fopen (link) call. It will tell you what the problem is. Most likely, it cannot find the file. The reasons could be misspelling, the file is in a different directory, or any number of other possibilities.
If fopen cannot open the file, then fileID is -1.
Edit: Also, thank you so much for replying!
The which function outputs indicate that your files do not exist anywhere in your MATLAB search path. You will have to find them somehow and copy them to a directory in your MATLAB search path if you want to use them.
If my Answer helped you solve your problem, please Accept it!
Thank you very much for this addition- that's exactly what I did, and at least that part of the program seems to be working!