selective remove lines from array
10 ビュー (過去 30 日間)
古いコメントを表示
hi !! some function for this small problem thank you
0 件のコメント
回答 (1 件)
Geoff Hayes
2014 年 5 月 7 日
Firas - if you have a matrix like the following:
Z =
1 6 11 16 21
2 7 12 17 22
3 8 13 18 23
4 9 14 19 24
5 10 15 20 25
You can remove the 3rd column (say) by simply typing:
% the colon indicates all row elements in the third column should be
% set to the empty matrix (which removes that column)
Z(:,3) = []
Z =
1 6 16 21
2 7 17 22
3 8 18 23
4 9 19 24
5 10 20 25
To remove the 4th row, you do something similar:
Z(4,:) = []
Z =
1 6 16 21
2 7 17 22
3 8 18 23
5 10 20 25
The above is just one way to remove a row or column (line) from a matrix (array).
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Operators and Elementary Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!