Splitting a matrix into submatrices by value
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hey yo
am 11 Okt. 2018
Kommentiert: hey yo
am 11 Okt. 2018
Hello, I have a 10000x3 matrix called A. The 3rd column of the matrix consists of 0s and 1s. I want to create 2 submatrices where A1 collects all rows of A that has a 1 in the 3rd column. A2 should collect the rest of the columns. How can I do that? Thanks!
2 Kommentare
madhan ravi
am 11 Okt. 2018
Bearbeitet: madhan ravi
am 11 Okt. 2018
Give short example question is not clear . Give an example.
Akzeptierte Antwort
Mischa Kim
am 11 Okt. 2018
Bearbeitet: Mischa Kim
am 11 Okt. 2018
Something like this?
A = [2 3 0 3;...
3 2 1 3;...
2 2 1 2]
A =
2 3 0 3
3 2 1 3
2 2 1 2
A1 = A(A(:,3)==1,:)
A1 =
3 2 1 3
2 2 1 2
A2 = A(A(:,3)==0,:)
A2 =
2 3 0 3
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!