Deleting a Column from an array?
조회 수: 22 (최근 30일)
이전 댓글 표시
I am given a 21 x 345 array. I need to delete JUST column 190. How would I do so and keep all the rest the same so that it is a 21 x 344 array
댓글 수: 0
채택된 답변
Star Strider
2016년 3월 30일
If ‘M’ is your matrix, just set the entire column to the empty array []:
M(:,190) = [];
댓글 수: 0
추가 답변 (1개)
Joseph Cheng
2016년 3월 30일
편집: Joseph Cheng
2016년 3월 30일
you can use the indexing of arrays to delete a column.
A = 1:10; %1x10; counting from 1 to 10;
to delete column 9 (ie number 9)
A(:,9)=[] % which reads all rows of A in column 9 is now empty.
Thats what the : in the first part as indexing goes (rows, columns)
댓글 수: 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!