Problem 233. Reverse the vector
Solution Stats
Problem Comments
-
8 Comments
Added some more tests.
Test set needs a column vector.
As far as timing goes ...
x=rand(100,1);
tic;y=flipud(x);toc
Elapsed time is 0.068947 seconds.
tic;y=x(end:-1:1);toc
Elapsed time is 0.000026 seconds.
innovative
thanks Kristin but I got it on my own
I'm not understanding why sort(x, 'descend') is not correct. On matlab works.
GOOD
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
-
1 Comment
good one
-
1 Comment
Easy!
-
1 Comment
So easy, use flip command
-
1 Comment
good problem
-
1 Comment
good one
-
1 Comment
https://www.mathworks.com/help/matlab/ref/flip.html
-
1 Comment
nice
-
1 Comment
easy
-
1 Comment
easy
-
1 Comment
I see I'm going to have to memorize a lot of this syntax to make my life easier.
-
1 Comment
This link can help:
https://in.mathworks.com/help/matlab/ref/fliplr.html
-
1 Comment
I did it!
(^^)v
-
1 Comment
gj
-
1 Comment
Errors in the test suite.
-
1 Comment
This user (mohamed elbesealy) appears to have gamed the system, with fraudulent "likes" of this unremarkable solution submitted by 'sock-puppet' accounts. —DIV
-
1 Comment
Never knew about rot90. I did, y = x(length(x):-1:1) and the size was 19! Learnt something new..
-
1 Comment
That was easy
-
1 Comment
we had a similar problem in my class
-
1 Comment
easy one
-
1 Comment
how to make the code even shorter than this???
-
1 Comment
helpfull!
-
1 Comment
Test set needs a column vector.
Problem Recent Solvers10845
Suggested Problems
-
1058 Solvers
-
578 Solvers
-
Simple equation: Annual salary
4071 Solvers
-
Flip the vector from right to left
6588 Solvers
-
Find the Oldest Person in a Room
12907 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!