How to save corresponding elements in a matrix?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hannah Schultejans
il 24 Lug 2015
Modificato: Azzi Abdelmalek
il 24 Lug 2015
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 Commenti
Risposta accettata
Azzi Abdelmalek
il 24 Lug 2015
Modificato: Azzi Abdelmalek
il 24 Lug 2015
B=A(A(:,1)>3,:)
If you want to save just the second column
B=A(A(:,1)>3,2)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!