필터 지우기
필터 지우기

how do i reverse a vector

조회 수: 219 (최근 30일)
ken  masters
ken masters 2011년 6월 13일
댓글: Cyrus David Pastelero 2020년 7월 8일
so far i have this
function [Vout]=reverse(Vin)

채택된 답변

Youssef  Khmou
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
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?
Andrei Bobrov
Andrei Bobrov 2013년 6월 28일
wrev(vect) -> vect(end:-1:1)
please try:
>> open wrev

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Royi Avital
Royi Avital 2011년 6월 13일
This might work as well (For 1D Vectors):
vReversed = v(end:-1:1);
Good luck!
  댓글 수: 3
Walter Roberson
Walter Roberson 2013년 6월 28일
Matt Eicholtz points out that Shweta's comment is incorrect; no subtraction is done, only indexing.
Cyrus David Pastelero
Cyrus David Pastelero 2020년 7월 8일
This is what I am looking for. Thank you.

댓글을 달려면 로그인하십시오.


Walter Roberson
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.

goga
goga 2011년 11월 19일
use fliplr()

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by