필터 지우기
필터 지우기

How to remove rows or Cols in MATLAB?

조회 수: 2 (최근 30일)
Ronak
Ronak 2021년 2월 22일
댓글: Ronak 2021년 2월 22일
I have a Matrix (A) of dimension 501*502*38. How can I make it 501*502*37?

답변 (2개)

M.B
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
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
Bob Thompson
Bob Thompson 2021년 2월 22일
Mr. B's answer also works, and may be easier.
Ronak
Ronak 2021년 2월 22일
Thank you so much! It was really helpful.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by