Problem with num2str, complex?
Show older comments
Hi, im using the num2str command in this script:
for i=1:N
p=[path,'/dire.',num2str(i),'/info.out'];
fid=fopen(p);
c=textscan(fid,'%s %s %s %s %s %s %s %s %s');
fclose(fid);
(...)
end
when i=1, the file path/dire.1/info.out is loaded normally, but when i=2 i get this message ??? Error using ==> textscan Invalid file identifier. Use fopen to generate a valid file identifier.
When i display p on screen i get:
p =
/home/f302/Trabajo final/Simulaciones/Migycapt/tipo 1/out1/dire.0+1i/info.out
is the program assuming i as a complex? thanks to all!
Answers (1)
Jos (10584)
on 6 Mar 2014
clear all
i
i = 1 ;
i
Tip : avoid using i as a iterator …
Categories
Find more on Scope Variables and Generate Names in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!