A simple matrix question

조회 수: 1 (최근 30일)
Rengin
Rengin 2019년 8월 5일
답변: madhan ravi 2019년 8월 5일
%Dear users,
%Imagine that I have a matrix of A=[1,2,3,4,5]
%Is there any short-cut to get the matrix of B=[5,4,3,2,1]?
%Thanks in advance

채택된 답변

Joel Handy
Joel Handy 2019년 8월 5일
A = [1 2 3 4 5];
B = fliplr(A) % Flip matrix in left/right direction
A = [1; 2; 3; 4; 5];
B = flipud(A) % Flip matrix in up/down direction

추가 답변 (3개)

Alex Mcaulley
Alex Mcaulley 2019년 8월 5일
sort(A,'descend')

Torsten
Torsten 2019년 8월 5일
fliplr(A)

madhan ravi
madhan ravi 2019년 8월 5일

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by