File Exchange

image thumbnail

function making input twice

version 1.0 (1000 Bytes) by

calculate double of a number by just passing the number in the argument of the function



View License

the problem solved by this is just multiplication of a variable by 2 ..

Comments and Ratings (4)

Owen Brimijoin

There are other ways of solving this problem. I have here a humble suggestion:

function y = myfun(x)
y = toc;

Note that for large values of x, this may take some time to execute. It also may not return a precise value.


Eric (view profile)

Thanks for this wonderful submission. I had no idea Matlab could perform multiplication! For years I've been saving variables to spreadsheets, multiplying them in Excel, and then importing them back to Matlab. I shudder at the countless hours I've wasted when I could have just done this work in Matlab. Thanks again.

John D'Errico

John D'Errico (view profile)

Give me a break. And such a creative name for the function, my fun. Useless.

Jan Simon

Jan Simon (view profile)

Why do you think, that this function is useful for others? Multiplying a variable by 2 should not be done in a function, but directly in the code.

MATLAB Release
MATLAB 8.0 (R2012b)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video