MATLAB: Not enough input arguments

error

I get this error for a simple code
function f = fun(x)
f =2*x;
end
please help me

Best Answer

You have to call your function as:
x = 42;
y = fun(x);
Simply using the ‘Run’ option by clicking the green arrow in the Editor will not work.