Deleting a Column from an array?
47 ビュー (過去 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 で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!