Splitting a matrix into submatrices by value
    조회 수: 11 (최근 30일)
  
       이전 댓글 표시
    
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
  madhan ravi
      
      
 2018년 10월 11일
				
      편집: madhan ravi
      
      
 2018년 10월 11일
  
			Give short example question is not clear . Give an example.
채택된 답변
  Mischa Kim
    
      
 2018년 10월 11일
        
      편집: Mischa Kim
    
      
 2018년 10월 11일
  
      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
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


