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 Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by