MATLAB: Function definitions are not permitted in this context

function contextMATLAB and Simulink Student Suite

Using Matlab R2017b, I can not define a function; I thought this was fixed in R2016b. Yes, I can define a script file.
>> function y = mydouble(x)
function y = mydouble(x)
Error: Function definitions are not permitted in this context.

Best Answer

What was "fixed" is that you are now allowed to define local functions in scripts. However, you cannot define functions (except anonymous functions) at the command line.