MATLAB supports a new syntax for passing name-value arguments. In the new syntax, the name and value arguments are connected by an equal sign, and the name is not enclosed in quotes.
The recommended practice is to use only one syntax in any given function call. However, if you do mix name=value and name,value syntaxes in a single call, all name=value arguments must appear after the name,value arguments. For example, plot(x,y,"Color","red",LineWidth=2) is a valid combination, but plot(x,y,Color="red","LineWidth",2) errors.
Similarly, name=value arguments must appear after all positional arguments. Calling myFunction(name=value,posArgument) errors.
The name=value syntax can only be used directly in function calls. They cannot be wrapped in a cell array or additional parentheses. Calling myFunction(a,(name=value)) errors.
Taken from the official release notes:
MATLAB supports a new syntax for passing name-value arguments. In the new syntax, the name and value arguments are connected by an equal sign, and the name is not enclosed in quotes.
Name=value syntax:
plot(x,y,LineWidth=2)
Comma-separated syntax:plot(x,y,"LineWidth",2)
The recommended practice is to use only one syntax in any given function call. However, if you do mix name=value and name,value syntaxes in a single call, all name=value arguments must appear after the name,value arguments. For example,
plot(x,y,"Color","red",LineWidth=2)
is a valid combination, butplot(x,y,Color="red","LineWidth",2)
errors.Similarly, name=value arguments must appear after all positional arguments. Calling
myFunction(name=value,posArgument)
errors.The name=value syntax can only be used directly in function calls. They cannot be wrapped in a cell array or additional parentheses. Calling
myFunction(a,(name=value))
errors.