extract data from a text data.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi all!
i have a text file. it is constructed like this:
input start1
a:12 b:1.5 c:1.75 d:0.25
a:52 b:3.5 c:2.75 d:0.75
a:12 b:1.5 c:1.75 d:0.25
...
...
...
a:12 b:1.5 c:1.75 d:0.25
output end1
input start2
a:12 b:1.5 c:1.75 d:0.25
a:52 b:3.5 c:2.75 d:0.75
a:12 b:1.5 c:1.75 d:0.25
...
...
...
a:12 b:0 c:1.752 d:0.225
output end2
input start3
..
...
...
...
How could read this text file? imean i want just th parameter a b c d .
thank you
0 comentarios
Respuesta aceptada
bruno
el 3 de Jul. de 2013
fid=fopen('file.txt','r');
text=textscan(fid,'a:%f b:%f c:%f d:%f \n');
fclose(fid);
text will be a 1*4 cell array, where text{1,1} is the vector of all your a, where text{1,2} is the vector of all your b...
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Text Data Preparation 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!