|
Hi Guys can you someone help me with the following, it was working for me before but i don't know what is the problem now,... I have a simple script in which i have to open a text file but i'm getting the following error:
Error using ==> textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in ==> spfit_echidna at 123
allstrings = textscan(fid,'%s');
part of the script:
filename=sprintf('%s%d_%d_%s.%s\n','000',runs(ii), peak, fit, 'TXT');
% open file
[fid, message]=fopen(filename,'r');
if fid < 0
disp(message)
end
% scan file
allstrings = textscan(fid,'%s');
fclose(fid);
allstrings = allstrings {:};
----
strangly enough when i just manually copy the file name from "sprintf" and open the file as follows it works properly, :
fid=('copy_manually_from_filename_sprintf')
many thanks,
ondrej
|