The name "is_fbk" is not defined as a named argument.
Because by definition named arguments must come last AND all inputs between the positional and named arguments are repeating MATLAB concludes that therefore everything from DAT to "is_fbk",false must be the repeating argument. Although you might think that the strings would throw an error with MUSTBENUMERIC, in fact the DOUBLE implicitly converts any input to double, including strings: "class — Class or MATLAB data type specified by name, such as double. The input must be the specified type or a type that can be converted to that type. For example, a function that specifies double accepts values of class single and converts them to double" (bold added).
The documentation states "Validation functions error when the input arguments do not match their conditions", but apparently MATLAB attempts the (implicit) type conversion before checking the input with the validation functions (the documentation phrasing could be improved here).
This implicit conversion is also explained in the documentation:
and advises "To avoid conversion of strings to numeric values, use mustBeA, mustBeFloat, or mustBeNumeric."
In short, there is little point in defining both the class and the validation function:
- if the array must be one specific class AND you want to allow implicit conversion then then specify the class.
- if the array can be any numeric class (but should definitely not be anything non-numeric) then specify the validation function.
Defining both only serves to confuse you.