classdef MyClass < nelson.mixin.SetGetExactNames
set(obj, name, value)
value = get(obj, name)
| Parameter | Description |
|---|---|
| obj | a handle object of a class deriving from nelson.mixin.SetGetExactNames. |
| name | a property name (char or string), or a cell array of names, spelled with the exact case. |
| value | the value to assign. |
| Parameter | Description |
|---|---|
| value | the property value. |
Derive a handle class from nelson.mixin.SetGetExactNames to give it set and get methods for reading and writing properties by name. It behaves exactly like nelson.mixin.SetGet, from which it derives, except that property names are matched case-sensitively: a name that differs from the declared property only in case is rejected.
set(obj, name, value) assigns a property; set(obj, n1, v1, n2, v2, ...) assigns several. get(obj, name) returns a property value; get(obj) returns a structure of all properties.
classdef Widget < nelson.mixin.SetGetExactNames
properties
Width = 0
Height = 0
end
end
w = Widget();
set(w, 'Width', 100);
get(w, 'Width') % returns 100
get(w, 'width') % error: 'width' is not the declared name 'Width'
| Version | Description |
|---|---|
| 2.0.0 | initial version |