%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 日

0 投票

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 日

0 投票

sort(A,'descend')
Torsten
Torsten 2019 年 8 月 5 日

0 投票

fliplr(A)

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

タグ

質問済み:

2019 年 8 月 5 日

回答済み:

2019 年 8 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by