Author Topic: Text file read in  (Read 404 times)

Offline jwarnett

  • Newbie
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
Text file read in
« on: June 15, 2011, 05:12:21 PM »
Hello
I have a dump output from another program. A short example of which is below
 
ITEM: TIMESTEP
1000
ITEM: BOUNDS
0 10
0 10
0 10
ITEM
id type xs ys zs
1 1 0.1 0.1 0.2
3 1 0.5 0.5 0.4
2 1 0.2 0.3 0.4
ITEM: TIMESTEP
2000
ITEM: BOUNDS
....
 
it then repeats within the same file for other timesteps. I want it to search for a specific timestep within the file (say 1000), then skip down to 'id type xs ys zs' and save the values xs,ys,zs into a (n,3) array. It would need to stop reading when it detects that the line is no longer numeric.
To me this seems like a simple problem, but it appears that matlaab can only read in full files, as I cannot find a 'skip x lines' function, or 'find value in text file' option. Does matlab keep this behind the scenes and not have it as an option for users?
Jay

Matlab and SimuLink Development Forum

Text file read in
« on: June 15, 2011, 05:12:21 PM »