Matlab - text file read in

Discussion in 'Programmer's Corner' started by jwarnett, Jun 15, 2011.

  1. jwarnett

    Thread Starter New Member

    Dec 1, 2010
    2
    0
    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
     
Loading...