I'm running Octave version 3.0.3 under Mac OS 10.4.11 on a Mac PowerPC
G4. I'm attempting to read a file of spherical harmonic coefficients of
the form:
2 0 0.202150907893000000e-03
0.000000000000000000e+00
3 0 0.121260448837000000e-04 0.000000000000000000e+00
4 0 -0.145383007072000000e-06 0.000000000000000000e+00
3 1 0.307082741328000000e-04 0.561066891941000000e-05
4 1 -0.717780149806000000e-05 0.294743374914000000e-05
2 2 0.223035130900000000e-04 0.000000000000000000e+00
3 2 0.488840471683000000e-05 0.168743052295000000e-05
4 2 -0.143951838385000000e-05 -0.288437212720000000e-05
2 3 0.000000000000000000e+00 0.000000000000000000e+00
3 3 0.143603108489000000e-05 -0.334354467700000000e-06
4 3 -0.854788154819000000e-07 -0.788967312839000000e-06
2 4 0.000000000000000000e+00 0.000000000000000000e+00
3 4 0.000000000000000000e+00 0.000000000000000000e+00
4 4 -0.154903893130000000e-06 0.564041555720000000e-07
In Fortran I can read and store each of the cosine (Cij) and
sine (Sij) coefficients using:
read( unit = lulugr, fmt = *, iostat = iret )
i, j, Cl(i,j), Sl(i,j)
In Octave I attempted to do the same thing using fscanf:
[ j, k, Cl(j+1,k+1), Sl(j+1,k+1), KOUNT ] =
fscanf( gravfile, "%i %i %e %e", "C" );
Octave returns an error message stating that k is undefined.
The questions I have for this list are: (1) what am I doing wrong, and
(2) how do I get Octave to input data from an ASCII file like the one
illustrated above?
Thanks in advance,
Sam Dupree.
|