Reputation: 2263
I have a file that looks like this:
(floor 12)
( x y z u v w diameter t mass-flow mass frequency time name)
(( 4.0331e-01 0.0000e+00 1.3201e+00 -3.1926e-03 -2.9862e-02 2.5690e-02 2.5000e-06 3.0000e+02 0.0000e+00 8.1665e-15 0.0000e+00 5.8257e+02) injection-0:8)
I'd just like the x y z values. I'm using textscan unsuccessfully but am open to suggestions:
[x y z] = textscan (fid, '%n %n %f %f %f %*[^\n]', 'HeaderLines', 2);
I'm not sure how to treat ((
. What are the options?
Regards,
Upvotes: 0
Views: 1031
Reputation: 3306
Well if it's always ((
then the following should work, it will put your 3 values into a cell, hence the myCell{1} to allocate the values if you need them in a seperate variables.
myCell = textscan (fid, '(( %f %f %f %*[^\n]', 'HeaderLines', 2);
x=myCell{1};
y=myCell{2};
z=myCell{3};
Upvotes: 2
Reputation: 272517
You could just call fgets()
twice before you call textscan()
to skip the headers.
Upvotes: 0