Thread Subject: Couple of Tricky Text File Imports

Subject: Couple of Tricky Text File Imports

From: Adam Hartshorne

Date: 16 Mar, 2009 16:13:13

Message: 1 of 2

I have a couple of text file I need to import data from and not sure really about the best way of going about these.

1) Easiest first,

No Joints :- 9
No Edges :- 5

Edge 1 :- 1 <-> 2
Edge 2 :- 2 <-> 3
Edge 3 :- 1 <-> 4
Edge 4 :- 1 <-> 5
Edge 5 :- 5 <-> 7

I need to grab grab the No Joint value and export to a variable, then have each "edge" "from" and "to" ideally as a matrix of nEdges x 2 (i.e to from for each edge). Would also be good to grab the No Edges value and check be able to check against the actual number of edge connections provided.

2)

No Joints :- 9
No Frames :- 2

Frame :- 1

Joint 1 :- 0.0556448 0.00532726 0.0993343
Joint 2 :- -0.0106789 -0.0177691 0.0243293
Joint 3 :- 0.0822542 0.144008 0.0473153
Joint 4 :- 0.127249 0.0704685 0.225934
Joint 5 :- 0.0241282 0.106974 0.00568629
Joint 6 :- 0.0943155 0.266603 0.0214314
Joint 7 :- 0.314652 0.176141 -0.0798468
Joint 8 :- 0.265005 0.163304 0.0688348
Joint 9 :- 0.265005 0.163304 0.0688348

Frame: 2
......

Again I need to grab out the No Joints variable, and this time the No Frames variable and check that have that amount of blocks. Then a cell array of nFrame elements, with each cell element containing a nJoints x 3 matrix of the jointPos.

Any help would be much appreciated.

Subject: Couple of Tricky Text File Imports

From: Miroslav Balda

Date: 17 Mar, 2009 05:37:02

Message: 2 of 2

"Adam Hartshorne" <adam.hartshorne@gmail.com> wrote in message <gpltqp$oho$1@fred.mathworks.com>...
> I have a couple of text file I need to import data from and not sure really about the best way of going about these.
:
SNIP
:
> Any help would be much appreciated.

Hello,

I would usemny function for a free format read = ffread (FEX Id. 09034), which enables rather simple input of various mixed text-numerical data. See its help both from files and strings.

Mira

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
text Adam Hartshorne 16 Mar, 2009 12:19:38
import Adam Hartshorne 16 Mar, 2009 12:19:38
rssFeed for this Thread

Contact us at files@mathworks.com