Added some more tests.
Test set needs a column vector.
As far as timing goes ...
Elapsed time is 0.068947 seconds.
Elapsed time is 0.000026 seconds.
thanks Kristin but I got it on my own
I'm not understanding why sort(x, 'descend') is not correct. On matlab works.
y = flip(x);
I see I'm going to have to memorize a lot of this syntax to make my life easier.
This link can help:
Here is my solution;
function y = reverseVector(x)
y(1+i) = x(end-i);
I did it!
Errors in the test suite.
This user (mohamed elbesealy) appears to have gamed the system, with fraudulent "likes" of this unremarkable solution submitted by 'sock-puppet' accounts. —DIV
Never knew about rot90. I did, y = x(length(x):-1:1) and the size was 19! Learnt something new..
That was easy
we had a similar problem in my class
how to make the code even shorter than this???
Sort a list of complex numbers based on far they are from the origin.
Number of 1s in the Binary Representation of a Number
Project Euler: Problem 6, Natural numbers, squares and sums.
The sum of the numbers in the vector
04 - Scalar Equations 2
Arrange Vector in descending order
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office