Problem with num2str, complex?

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!

Réponses (1)

Jos (10584)
Jos (10584) le 6 Mar 2014

0 votes

clear all
i
i = 1 ;
i
Tip : avoid using i as a iterator …

Catégories

En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by