Error with selecting data in 3D matrix

조회 수: 1 (최근 30일)
Sam
Sam 2015년 1월 3일
편집: dpb 2015년 1월 4일
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
Sam
Sam 2015년 1월 3일
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 2015년 1월 3일
편집: dpb 2015년 1월 4일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by