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 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!