How to move elements of a vector

조회 수: 3 (최근 30일)
cami
cami 2018년 11월 25일
댓글: cami 2018년 11월 26일
I'd want the code that given the vector A
A=[ 1 2 4 3 0 1 5 3 7 9]
returns
A=[ 1 2 3 4 0 1 3 5 7 9]
thanks
  댓글 수: 2
Image Analyst
Image Analyst 2018년 11월 25일
There are many possible ways, like using deal(). What is your rule for the new order?
cami
cami 2018년 11월 26일
i want to rebuild the original matrix...
in my case the best way would be using fliplr

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

답변 (1개)

Matt J
Matt J 2018년 11월 25일
편집: Matt J 2018년 11월 25일
A([ 3:4:end, 4:4:end]) = A([ 4:4:end, 3:4:end])

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by