how do i reverse a vector
Afficher commentaires plus anciens
so far i have this
function [Vout]=reverse(Vin)
Réponse acceptée
Plus de réponses (3)
Royi Avital
le 13 Juin 2011
This might work as well (For 1D Vectors):
vReversed = v(end:-1:1);
Good luck!
3 commentaires
Shweta Kanitkar
le 29 Mai 2013
v(end:-1:1) subtracts each element from v(end) by 1.
Walter Roberson
le 28 Juin 2013
Matt Eicholtz points out that Shweta's comment is incorrect; no subtraction is done, only indexing.
Cyrus David Pastelero
le 8 Juil 2020
This is what I am looking for. Thank you.
Walter Roberson
le 13 Juin 2011
2 votes
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.
goga
le 19 Nov 2011
1 vote
use fliplr()
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!