How can I make this matrix ?
조회 수: 1 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1229847/image.png)
댓글 수: 0
채택된 답변
Voss
2022년 12월 13일
% your matrix:
i = 0; m = 1; j = 2; n = 3;
M = repmat([i i i m m j j j n n],4,1)
% delete columns 4-5 and 9-10:
M(:,[4 5 9 10]) = []
댓글 수: 4
Voss
2022년 12월 14일
Suppose you want to delete columns 4, 9, 14, ... and columns 5, 10, 15, ...
M = reshape(1:100,4,[])
spacing = 5;
N_Cols = size(M,2);
col_to_delete = [4:spacing:N_Cols 5:spacing:N_Cols];
M(:,col_to_delete) = []
No loop necessary.
추가 답변 (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!