how do i reverse a vector
591 ビュー (過去 30 日間)
古いコメントを表示
so far i have this
function [Vout]=reverse(Vin)
0 件のコメント
採用された回答
Youssef Khmou
2013 年 5 月 29 日
hi,
To reverse a vector try the function ' wrev' , here is an example :
r=wrev(1:4)
If you to control the degree of reverse/shifting try 'circshift' function.
2 件のコメント
Matthew Eicholtz
2013 年 6 月 27 日
I like this solution. Does anybody know how fliplr and wrev differ in this particular case? Is one more computationally expensive than the other?
その他の回答 (3 件)
Royi Avital
2011 年 6 月 13 日
This might work as well (For 1D Vectors):
vReversed = v(end:-1:1);
Good luck!
3 件のコメント
Walter Roberson
2013 年 6 月 28 日
Matt Eicholtz points out that Shweta's comment is incorrect; no subtraction is done, only indexing.
Walter Roberson
2011 年 6 月 13 日
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!