Clear Filters
Clear Filters

Error with selecting data in 3D matrix

1 view (last 30 days)
Sam
Sam on 3 Jan 2015
Edited: dpb on 4 Jan 2015
I have a 3D matrix. The first dimension contains all datapoints (of markers, forces, moments,...), the second contains all the headers/names (of the markers, forces, moments,...) and the third dimension contains the x, y or z-coordinates. (x = 1, y = 2, z = 3).
I want to select all the datapoints for the MARKERS only (x-coordinates):
VideoSignals(:,1:strcmpi('*13', data_stair_rise(1,1).VideoSignals_headers),1)
So first I put ':' to select all the datapoints, but then I need to select ONLY the markers: they go from '1' to '*13' and last I select the x-coordinates using '1'.
It gives an error probably because of a wrong use of brackets I suppose. I tried several things... Help?
  3 Comments
Sam
Sam on 3 Jan 2015
The second dimensions contains strings. It contains 1 row and (for example) 220 columns. I need to select all the markers for 5 subjects. I have noticed in my headers, that the 'markers' and the 'forces' (in the second dimension) are seperated by a string '*136' or '*137' or '*138' or '*139'. So I thought I could use 'strcmpi' to say to the computer that he should take the columns going from '1' tot the strcmpi '*13'-column.
dpb
dpb on 3 Jan 2015
Edited: dpb on 4 Jan 2015
We need SPECIFICS, not generalizations and what you "thought"...
Give an example of the data you're trying to parse.
Presumimg VideoSignals is an array and not a function, then the expression
VideoSignals(:,1:_something_,1)
is an addressing expression that addresses all rows (the first ':') by columns of some vector 1 thru whatever the something expression evaluates to over the first plane.
strcmpi will return a vector of T:F where the comparison succeeds or fails in the vector given it. Thus you've written (presuming the strcmpi call even works) an addressing expression like
VideoSignals(:,1:[T F F F ... T ...],1)
This clearly isn't valid Matlab syntax as written so it won't be even if obfuscated by not having a variable to store the result of the function call into and use...
Think first, type later...
ADDENDUM
VideoSignals(:,1:[T F F F ... T ...],1) ... isn't valid Matlab syntax ...
But, if it really is what you're looking for,
VideoSignals(:,[T F F F ... T ...],1)
could be if the logical vector is of the right dimension and the assignment is written correctly so number elements of LHS is same as those of RHS.

Sign in to comment.

Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!