How to remove rows or Cols in MATLAB?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a Matrix (A) of dimension 501*502*38. How can I make it 501*502*37?
0 件のコメント
回答 (2 件)
M.B
2021 年 2 月 22 日
Let A be your matrix. You can remove the last 2D matrix like this:
A(:, :, 38) = [];
Replace "38" by the index of the 2D matrix you want to remove.
Bob Thompson
2021 年 2 月 22 日
You can remove a section of an array in MATLAB by redefining the array without that specified section. For your example, of you don't want the last 'sheet' use the following:
A = A(:,:,1:end-1);
If you want to get rid of a specific sheet use the following:
s = 23; % Specific sheet number, adjust as desired
A = A(:,:,[1:s-1,s+1:end]);
2 件のコメント
参考
カテゴリ
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!