MATLAB Answers

Ninetrees
0

textscan and multidimensional arrays

Ninetrees
さんによって質問されました 2011 年 9 月 19 日
I have a text file that contains recordS 600 bytes long. The data is mixed: date, time, chars, ints, fps.
I am using textscan for the first time. I currently set up a format string for the whole record that seems to be working correctly...the file contains ~4000 records (varies). I am testing with a 3-record subset.
Some of the data is related. In one instance, 3 sequential values are values comprise 3D vector. textscan places these values in vectors in cells, so that I have (for example) c{39} contains the x-component, &c. I now do this A3Dvec = [ c{39} c{40} c{41} ] A3Dvec = A3Dvec' which seems a bit awkward to me because I used textscan in the first place for its speed and convenience (don't have to loop through the file).
At least it works. Is there a better way?
I hit a snag when I considered the rotation matrices. Here I have 9 sequential values that define a rotation matrix.
1 2 3
4 5 6
7 8 9
It seems to me that I can use a series of steps to create 3D matrices and then transpose and combine them into the RotMatrix array (not sure at this point), but that seems like I am overthinking the problem.
Am I missing a step in the way I use textscan? Is there a better way to create A3Dvec? How should I create RotMatrix, which is an array 1:nrecords of RotMatrix?
Thanks, ~R~

  0 件のコメント

サインイン to comment.

0 件の回答


Translated by