Arguments block syntax not being recognised
26 views (last 30 days)
I'm trying to use an arguments block for input argument validation in a standalone function. I followed the instructions here, and even tried copying the forwardSpeed example:
% Function code
disp(class(a)) % Line 9 (where the error is located)
however the editor does not highlight the syntax properly, and when I try to run it, I get the following error:
Error: File: /home/$USER/forwardSpeed.m Line: 9 Column: 5
This statement is not inside any function.
(It follows the END that terminates the definition of the function "forwardSpeed".)
The output for my MATLAB version:
'18.104.22.1684997 (R2019a) Update 6'
Adam on 31 Jan 2020
Edited: Adam on 31 Jan 2020
This was only introduced in 2019b (you can see at the bottom of the help page for 'arguments'). It is one of the disadvantages of using the online help (which is always for the latest version) rather than your offline help (which is for your version).
You can use
to achieve similar though, which is what I have been doing the past many years.