How can i choose specific elements from matrix ?
Ältere Kommentare anzeigen
Hello ,
i have a mat 3x3 like this one below:
H=[001;110;010]
I want to choose the elements that contain 2 or more zeros .
How can i implement this method on matlab code ?I tried using find but it didnt turn out into something .
Any ideas would be useful.
Thank you
4 Kommentare
Mohammad Sami
am 6 Sep. 2020
Do you mean you want to select rows which have two or more zeros ? If so you can get the row index as follows.
if true
A = [0 0 1; 1 1 0; 0 1 0];
Z = A == 0;
Rownum = find(sum(Z,2) >= 2);
end
Gn Gnk
am 6 Sep. 2020
Asad (Mehrzad) Khoddam
am 6 Sep. 2020
if true line at begining and 'end' at the end is not necessary
Mohammad Sami
am 7 Sep. 2020
Yes. The two lines are added in when answering from mobile.
Antworten (0)
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!