Extract data from ASCII text file from specific lines and columns
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi Guys,
I have a compilation of reports in an ASCII file (see the file here: http://pastebin.com/wmmB92ZC ) I want to export them to MATLAB and I know the specific location of the data in column and line.
For example, the data for parameter N1 is located at line 37&38 at column 4. The next data for N1 comes after every 53 lines, which are 90&91, 143&,144 and so on.
I did try with text scan, but there is no option to specifically tell the exact location of the data in columns and lines.
Any help would be appreciated.
Thanks.
Regards, Wan
0 comentarios
Respuestas (1)
Walter Roberson
el 18 de Abr. de 2012
There is an undocumented textscan() option to specify column location. Unfortunately it only works with purely numeric data.
Anyhow, use the HeaderLines parameter to indicate how many lines to skip. Use a '%*s%*s%*s%d' format to skip the fist 3 columns and read the 4th as a number.
0 comentarios
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!