Making a textfile into a list in matlab?

Posted by Ben Fossen on Stack Overflow See other posts from Stack Overflow or by Ben Fossen
Published on 2010-06-15T18:50:09Z Indexed on 2010/06/15 18:52 UTC
Read the original article Hit count: 286

Filed under:
|

I have a textfile and would like to import it onto Matlab and make it a list

Person1
name = steven
grade = 11
age= 17

Person2
name = mike
grade = 9
age= 15

Person3
name = taylor
grade = 11
age= 17

There are a few hundred entries like these above. Each are seperated by a blank line I was thinking I could scan the text and make the information between each blank line into an item in the list. I also would like to be able to look up each person by name once I have a list like the one below.

I want something like

x = [Person1         Person2       Person3      
     name = steven   name = mike   name = taylor
     grade = 11      grade = 9     grade = 11
     age = 17        age = 15      age = 17]

This seems very straight forward but I have been having trouble with this so far, I may be overlooking something. anyone have any ideas or advice?

© Stack Overflow or respective owner

Related posts about list

Related posts about matlab