How to save corresponding elements in a matrix?
2 次查看(过去 30 天)
显示 更早的评论
If I have this matrix:
A=[1, 2;
4, 5;
6, 6]
How would I pull elements from the first column that are greater than 3 but save the corresponding elements in the second column to a new matrix? For reference, these columns have been abbreviated. The second column is time data, and the first is motion. I want to save the times when the motion data exceeded a set threshold.
0 个评论
采纳的回答
Azzi Abdelmalek
2015-7-24
编辑:Azzi Abdelmalek
2015-7-24
B=A(A(:,1)>3,:)
If you want to save just the second column
B=A(A(:,1)>3,2)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!