Problem 233. Reverse the vector
Reverse the vector elements.
Example:
Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]
Solution Stats
Problem Comments
-
9 Comments
Show
6 older comments
Isabella Stellitano
on 26 Oct 2021
GOOD
Gizem Deniz Akkas
on 18 Apr 2022
function y = rev(x)
y=sort(x,'descend');
end
i'm doing like this but i have 1 assertion error ? what's wrong?
yuyuyu
on 25 Apr 2025 at 11:50
"Iterate through the array from the last element to the first, decrementing the index by 1 in each iteration."
Solution Comments
Show commentsGroup

Advent of Code
- 25 Problems
- 5 Finishers
- Calculate days until Christmas
- How many Christmas presents under the tree?
- Snow Accumulation and Structural Risks To Residential Properties
- Scrabble Scores
- The twelve days of Christmas
- Calculate Wind Chill Factor
- Air Mass to Star for an Observer at Mean Sea Level
- Determine when snow started
- Mechanical Advantage of a Gear Train
- Similar Triangles - find the height of the tree
- Sleeping Queens 1
- Solve the Sudoku Row
- Fractal: area and perimeter of Koch snowflake
- Calculate Amount of Cake Frosting
- The cake is a lie...
- You LOVES Matlab 41%
- Minkowski distance
- Where the Four Corners Am I?
- Most Frequent Word - 01
- Design a tubesheet for shell-and-tube heat exchangers
- Lights Out 1 - 5x5, 3 moves
- Why the heck are they blinking!?!?
- Calculate the Distance to Source of Lightning
- Radiation Heat Transfer — View Factors (1)
- How many days?!?
Problem Recent Solvers15113
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!