Question: fscanf or Readdata

Hi!

I want to write the following textfile in a matrix of the size 4x24:

      1    0.5    0.5      1      1    0.5    0.5      1      1    0.5    0.5      1    0.25    0.25    0.25    0.25    0.25    0.25    0.25    0.25    0.25    0.25    0.25    0.25
 -0.25g -0.25g -0.25g -0.25g    -1g  -0.5g      0  -0.5g    -1g  -0.5g      0  -0.5g  -0.25g  -0.25g  -0.25g  -0.25g       0       0       0       0       0       0       0       0
   -1g -0.5g      0 -0.5g -0.25g -0.25g -0.25g -0.25g -0.5g      0 -0.5g   -1g      0      0      0      0 -0.25g -0.25g -0.25g -0.25g      0      0      0      0
 -0.5g      0 -0.5g   -1g -0.5g      0 -0.5g   -1g -0.25g -0.25g -0.25g -0.25g      0      0      0      0      0      0      0      0 -0.25g -0.25g -0.25g -0.25g
 
fscanf wasn't successful at all.:( (guess I was just to dumm to understand the code ^^)

readdata gave me a Matrix of strings.

A := readdata(".../alpha.txt", string, 24)

But then I wasn't able to parse the expression "0.5g" because of

> for i to 24 do

   for j to 4 do

       parse(A[j, i])

end do end do;
%;
Error, incorrect syntax in parse: missing operator or `;`

 

Has anybody got an idea?

Cheerio

Nicola

Please Wait...