MATLAb creating variables from ascii document

  • Context: MATLAB 
  • Thread starter Thread starter gryphon1221
  • Start date Start date
  • Tags Tags
    Matlab Variables
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 3K views
gryphon1221
Messages
9
Reaction score
0
Hi, I have a document with a whole bunch of header information and description. After about 20 lines it goes into the useful data. Each line of data is formatted like this:

P 1 1234.939 1234.505 1234.505 102

where P just denotes that it is data, 1 is a satellite number and the data is X Y Z and time.

Does anybody know how to import this data into useful variables X Y Z and time? I am thinking it will be textscan or something, but I have never used data in this format before. Thanks for any help.
 
Physics news on Phys.org
I'm pretty sure there's an easier way. A command that does it in one hit. But I forget.
 
I this case you can use dlmread
Much easier than fscanf etc

Just skip the.initial rows( the header) and the first column.