how to move a row

5 views (last 30 days)
Miri on 9 Jun 2022
Commented: Jeffrey Clark on 9 Jun 2022
I have a 802x1. I would like to move/insert row 801 right after 400. so that 801 is the new 401.
Jeffrey Clark
Jeffrey Clark on 9 Jun 2022
@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;

Sign in to comment.

Accepted Answer

James Tursa
James Tursa on 9 Jun 2022
result = M([1:400,801,401:800,802])

More Answers (0)

Community Treasure Hunt

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

Start Hunting!