[Scilab-users] Complex text file problem getting matrices from it
matacosta
matiashs at hotmail.com
Fri Feb 21 10:04:35 CET 2014
Dear All,
I need to obtain two matrices from a text file. Normally this should not be
a problem with fscanfMat but because I have headings in the middle of the
file this function does not work.
I though up to now in two solutions.
One is using mgetl and obtain the part where the first numbers are and then
the second (I have a problem with this since I am not sure if mgetl is able
to start getting the data from a certain line on or only beginning).
Therefore, I got properly the first half (which normally the fscanfMat
analysis properly) but the fscanfMat does not recognize the 3 columns, only
1 when I save with write. Is something of formatting but I do not get why
(related to tab and space, I checked manually).
The other to read the whole part of interested as 1 string with mgetstr.
Then separate this string with strsplit which I am having problems with the
matched_separators vector. Then I would transform that matrix of strings
into double. This would allow me to get both matrices but again i would have
the same problem of writing function.
Any help? better way of doing it?
A simplified version of the data is down:
"BW: 4"
"SWEEP AVERAGING: OFF"
"POINT AVERAGING: OFF"
"TRACE: A"
"FORMAT: LINEAR"
"Frequency" "Data Trace Real" "Data Trace Imag"
1.00000000000e+03 1.883005e-11 0.000000e+00
1.00000000000e+03 1.876519e-11 0.000000e+00
1.00000000000e+03 1.880004e-11 0.000000e+00
"TRACE: B"
"FORMAT: LINEAR"
"Frequency" "Data Trace Real" "Data Trace Imag"
1.00000000000e+03 1.906406e-02 0.000000e+00
1.00000000000e+03 1.790656e-02 0.000000e+00
1.00000000000e+03 1.664777e-02 0.000000e+00
1.00000000000e+03 1.774269e-02 0.000000e+00
Thanks a lot!!
--
View this message in context: http://mailinglists.scilab.org/Complex-text-file-problem-getting-matrices-from-it-tp4028793.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
More information about the users
mailing list