Question: Create a matrix from float search and extract in a text file

Hi everyone

I'm stuck with a maple problem

I've got a text file with hundred thousnad of numbers in that form, correspond to point position:

1728
 generated by VMD
  C1        -6.932300       12.540000      -20.260000
  C1        -7.005000       13.914000      -18.431999
  C2        -8.143600       11.942000      -19.424000
  C2        -8.236300       12.972000      -18.327000
  C3        -5.110600       12.270000      -18.719000
  C4        -5.390700       14.318000      -20.143000
  C5        -4.419600       15.242000      -19.368999
  C6        -2.534000       15.407000      -20.941000
  C1        10.458000      -20.974001       -1.023700
  C1         9.977000      -19.162001        0.231220

My problems is, I need to extract specific position, for example, extract all of the position of C1, and put them in a matrix, such as C11(x,y,z),C12(x,y,z)...

in order to be able to extract positions, I currently programmed that:


fileToImport := "metoxyHFtest.txt";

numberreadline := 10;

for i to numberreadline do

lineread := readline(fileToImport);

C6 = sscanf(lineread, " C6%f %f%f")

end do;

Which extract well the position of C6 in that case, but I don't understand how to put these C6 sting in a matrix, even more that each time maple don't find C6, an empty string is produce.

Thanks a lot in advance for your help!

cheers

 

Please Wait...