classdef MyClass < nelson.mixin.SetGet
set(obj, name, value)
value = get(obj, name)
| Parameter | Description |
|---|---|
| obj | a handle object of a class deriving from nelson.mixin.SetGet. |
| name | a property name (char or string), or a cell array of names. |
| value | the value to assign. |
| Parameter | Description |
|---|---|
| value | the property value. |
Derive a handle class from nelson.mixin.SetGet to give it set and get methods for reading and writing properties by name.
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. Property names are matched case-insensitively.
classdef Widget < nelson.mixin.SetGet
properties
Width = 0
Height = 0
end
end
w = Widget();
set(w, 'Width', 100, 'Height', 40);
get(w, 'Width')
| Version | Description |
|---|---|
| 2.0.0 | initial version |