Error with selecting data in 3D matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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 Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!