Borrar filtros
Borrar filtros

Reading Specific Lines and Coulmns

2 visualizaciones (últimos 30 días)
Köksal
Köksal el 19 de Ag. de 2014
Respondida: Michael Haderlein el 19 de Ag. de 2014
Hi all,
I'm trying to read specific lines from a file and I want to translate them into array. My template is like that:
Curveplot
Time
Z-force
Contact Id
Sl 1 #pts=151
* Minval= -3.710350e+003 at time= 0.002740
* Maxval= 2.669760e+003 at time= 0.001000
0.000000e+000 0.000000e+000
1.993210e-005 5.299370e+002
3.999280e-005 1.217220e+003
5.992490e-005 1.437750e+003
7.998550e-005 1.571400e+003
9.991760e-005 1.662600e+003
1.199780e-004 1.707430e+003
1.399100e-004 1.769070e+003
... ...
2.959890e-003 -3.544220e+003
2.979920e-003 -3.536640e+003
2.999960e-003 -3.529960e+003
endcurve
I need to take the second coulmn values between the line 8 and the last.
I'm waiting for your suggestions and answers.

Respuestas (1)

Michael Haderlein
Michael Haderlein el 19 de Ag. de 2014
Dear Köksal,
you can simply use textscan:
fid=fopen(filename);
data=textscan(fid,'%*f%f','delimiter','\t','MultipleDelimsAsOne',true,'headerlines',7)
fclose(fid);

Categorías

Más información sobre Data Import and Export en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by