it doesn't work .so,what is the problem?

function w= flip_it(v)
w = v(end:-1:1);
end

2 Comments

It does work, but I can't see why you don't just use the flip() command provided by MATLAB.
because, there was a restriction not to use flip() command

Sign in to comment.

Answers (1)

You did not say what the problem actually is. My guess is that you are not calling it correctly. You have to have ‘v’ in your workspace, then call your function as:
v = some_vector;
w = flip_it(v)

Categories

Tags

Asked:

on 24 Dec 2017

Answered:

on 24 Dec 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!