a=[1 2 3;5 8 9 ;5 6 4;1 2 5] I want to check whether a contains [5 6 4] in any row or not. How can I do this?

 Réponse acceptée

KSSV
KSSV le 1 Nov 2017
Modifié(e) : KSSV le 1 Nov 2017

1 vote

Read about ismember
a=[1 2 3;5 8 9 ;5 6 4;1 2 5] ;
b = [5 6 4] ;
idx = find(ismember(a,b,'rows'))

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by