finding elements in a matrix`
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ananya Malik
am 16 Aug. 2016
Bearbeitet: Thorsten
am 16 Aug. 2016
I have a a matrix A= [1 3 10; 1 8 10; 2 4 9] and an array x = [2 9]. i want to check if x is present in a single row of A. In this case it is true, so continue. Can anyone help? TIA.
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 16 Aug. 2016
Bearbeitet: Azzi Abdelmalek
am 16 Aug. 2016
A= [1 3 10; 1 8 10; 2 4 9]
x=[ 2 9]
for k=1:size(A,1)
idx=all(ismember(x,A(k,:)));
if idx
break
end
end
idx
1 Kommentar
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!