Flip the vector from right to left.
Examples
x=[1:5], then y=[5 4 3 2 1]
x=[1 4 6], then y=[6 4 1];
Request not to use direct function.
Solution Stats
Problem Comments
14 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers10654
Suggested Problems
-
Project Euler: Problem 7, Nth prime
1748 Solvers
-
10619 Solvers
-
Longest run of consecutive numbers
6435 Solvers
-
Check that number is whole number
5184 Solvers
-
Find the max element of the array
2119 Solvers
More from this Author70
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Try out this problem
Try Out this cody questions...
How can we do for last test case.
Can any one help me out?
how to solve below test case
%%
code = fileread('flip_vector.m');
assert(isempty(strfind(code, 'fliplr')));
Nice tricky problem
y=x(end:-1:1) I think this might help
You cannot pass the last test suite if you use the function fliplr
flipud(x')'
... didn't say anything about allowing flipud!
pretty simple
code = fileread('flip_vector.m');
assert(isempty(strfind(code, 'fliplr')));
Assertion failed.
Can anyone give me idea what is 'flip_vector.m' here?
@Ankit Meena,
'flip_vector.m' is the function file for the solution code submitted.
"code = fileread('flip_vector.m'); " -> This line of code is used to obtain the contents of your solution as a text file. And the next line of code checks for any requirement.
You can check that the first line in your solution will be -
function output = flip_vector(input)
(output and input being placeholders)
I hope this answers your question.
Nice problem
Nice problem!
Not using Matlab dedicated function to this should be written in the problem statements. I dislike this kind of "twist". Nonsense.
@Nicolas, It IS written in the problem statement -
"Request not to use direct function."