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
-
8 Comments
Show
5 older comments
Roberto DADDA
on 9 Dec 2020
I'm not understanding why sort(x, 'descend') is not correct. On matlab works.
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?
Solution Comments
Show commentsProblem Recent Solvers14842
Suggested Problems
-
Find state names that end with the letter A
1186 Solvers
-
Arrange Vector in descending order
11978 Solvers
-
Rotate input square matrix 90 degrees CCW without rot90
637 Solvers
-
Piecewise linear interpolation
562 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
1986 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!