Command to delete last row and column of a matrix

조회 수: 103 (최근 30일)
Swati Sarangi
Swati Sarangi 2020년 1월 28일
댓글: Bhaskar R 2020년 1월 28일
Hi,
Can anyone help me with the command to delete the last row and column of a 6 x 6 matrix?
Regards
Swati

채택된 답변

Alex Mcaulley
Alex Mcaulley 2020년 1월 28일
A(:,end) = []; %Delete last column
A(end,:) = []; %Delete last row

추가 답변 (1개)

Bhaskar R
Bhaskar R 2020년 1월 28일
your_matrix(end, :) = []; % deletes your matrix end(last) row
your_matrix(:, end) = []; % deletes your matrix end(last) column
  댓글 수: 2
Swati Sarangi
Swati Sarangi 2020년 1월 28일
Hi,
Thanks for replying.
I just want to know the reason for assigning the final result to an empty matrix.
Regards
Swati

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

카테고리

Help CenterFile Exchange에서 Particle Swarm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by