help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fscanf question


From: John B. Thoo
Subject: fscanf question
Date: Sat, 1 Feb 2003 21:43:18 -0800

Hi. I have a question about using fscanf. I've read the manual to no avail. My problem is this. I'm trying to read a data file with 400 pairs of data in two columns using


meqn = 2;
mx = 180;
   data = fscanf(fid,'%g',[meqn,mx]);


When  mx <= 188,  all is well.  E.g., when  mx = 180,  I get


data =

 Columns 1 through 5:

    1.8981e-37    3.9947e-37    8.2387e-37    1.6695e-36    3.3303e-36
    0.0000e+00    0.0000e+00    0.0000e+00    0.0000e+00    0.0000e+00

 Columns 6 through 10:

    6.5473e-36    1.2698e-35    2.4309e-35    4.5952e-35    8.5783e-35
    0.0000e+00    0.0000e+00    0.0000e+00    0.0000e+00    0.0000e+00


etc., which is correct. But when mx >= 189, all is _not_ well. E.g., when mx = 190, I get


data =

 Columns 1 through 6:

   0.0000000   0.0000000   0.0000000   0.0000000   0.0000000   0.0000000
   0.0000000   0.0000000   0.0000000   0.0000000   0.0000000   0.0000000

 Columns 7 through 12:

   0.0000000   0.0000000   0.0000000   0.0000000   0.0000000   0.0000000
   0.0000000   0.0000000   0.0000000   0.0000000   0.0000000   0.0000000


with zeros continuing to the end, so I can't read the entire data file (400 rows) correctly. What am I doing wrong?

Thanks.

---John.



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]