I have a 802x1. I would like to move/insert row 801 right after 400. so that 801 is the new 401.

댓글 수: 2

Jeffrey Clark
Jeffrey Clark 2022년 6월 9일
If m is a matrix m = [m(1:400,:);m(801,:);m(401:800);m(802:end,:)];
If m is a row vector remove the ,: in each above.
If m is a column vector or otherwise I don't understand the question.
@Miri you could do this implace if you are concerned with the memory associated with creating another array/matrix:
m801 = m(801,:);
m(402:801,:) = m(401:800,:);
m(401,:) = m801;

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

 채택된 답변

James Tursa
James Tursa 2022년 6월 9일

1 개 추천

result = M([1:400,801,401:800,802])

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2022년 6월 9일

댓글:

2022년 6월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by