From bug-octave-request Thu Jul 29 16:32:11 1993 Subject: fscanf behavior From: hodelas at CONTROLS dot MSFC dot NASA dot GOV (A. Scott Hodel) To: bug-octave Date: Thu, 29 Jul 93 15:24:19 CDT This may be my ignorance rather than a bug. Here's the m-file: function [a,b,c,d,stname,inname,outname] = marsyas_in() % % load a hybrid linear system in from Marsyas output % st_file = fopen('marsyas.st','r') n = fscanf(st_file,'%d') disp(['Loading ',num2str(n),' states']) stname = ' ' for ii=1:n stname(ii) = fscanf(st_file,'%s') endfor fclose(st_file) endfunction ------------------------------------ Here's the data: file marsyas.st: 32 (SUBA) PFTD (SUBA) MFTD (SUBA) NFTP (SUBA) WDFP1 (SUBA) PFPD (SUBB) NOTPA (SUBB) WDOP1 (SUBB) POPD (SUBC) MFTHETADOT [...] --------------------------- Here's the octave output: octave:1> implicit_str_to_num_ok implicit_str_to_num_ok = false octave:2> marsyas_in error: failed to convert `(SUBA)' to a numeric type -- default conversion turned off st_file = 3 n = 32 Loading 32 states stname = octave:2> marsyas_in fscanf: invalid conversion error: `n' undefined st_file = 3 octave:2> For some reason octave is trying to turn a string into a number, Ithink.