split the matrix into two
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello everyone
I have a matrix. And I want to split this matrix into two matrices, but there's a rule.
It needs to get 1,3,5 columns to create the first matrix. It needs to get columns 2,4,6 .. to create the second matrix. (My real matrix is a very large 50x138 matrix, but I'll show it with a small example.)
Sample :
1 4 8 7 5 9
2 7 5 6 4 3
8 7 6 5 5 1
new A matrix :
1 8 5
2 5 4
8 6 5
new B matrix :
4 7 9
7 6 3
7 5 1
Thank u for help.
댓글 수: 0
채택된 답변
추가 답변 (1개)
Murugan C
2022년 3월 29일
odd_Mat = A(:,1:3:end); % Odd column matrix extraction
even_mat = A(:,2:2:end); % Even column matrix extraction
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!