how do i reverse a vector
古いコメントを表示
so far i have this
function [Vout]=reverse(Vin)
採用された回答
その他の回答 (3 件)
Royi Avital
2011 年 6 月 13 日
This might work as well (For 1D Vectors):
vReversed = v(end:-1:1);
Good luck!
3 件のコメント
Shweta Kanitkar
2013 年 5 月 29 日
v(end:-1:1) subtracts each element from v(end) by 1.
Walter Roberson
2013 年 6 月 28 日
Matt Eicholtz points out that Shweta's comment is incorrect; no subtraction is done, only indexing.
Cyrus David Pastelero
2020 年 7 月 8 日
This is what I am looking for. Thank you.
Walter Roberson
2011 年 6 月 13 日
2 投票
fliplr() or flipud()
... But I suspect this is a class assignment. You will need to use your knowledge of MATLAB indexing and looping to work out your assignments for yourself.
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!