Create an object and assign a value to its property.
obj = MyClass;
obj.Prop1 = containers.Map;
Error setting 'Prop1' property of 'MyClass' class:
Values must not be empty.
When you assign a value to the property, MATLAB calls mustBeNonempty with the value being assigned to the property. mustBeNonempty issues an error because the value assigned to Prop1 is empty.
Restrict Function Argument Values
This function restricts the input argument to be a nonempty character vector.
function str = mbNonempty(name)
arguments
name (1,:) char {mustBeNonempty}end
str = sprintf('Name: %s',name);
end
Calling this function with an empty character vector results in an error being thrown by mustBeNonempty.
mbNonempty('')
Error using mbNonempty
Invalid input argument at position 1. Value must not be empty.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.