A simple matrix question

1 次查看(过去 30 天)
%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 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by