nelson.mixin.SetGetExactNames
Set and get property access with case-sensitive names.
📝Syntax
classdef MyClass < nelson.mixin.SetGetExactNames
set(obj, name, value)
value = get(obj, name)
📥Input Arguments
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.
📤Output Arguments
Parameter Description
value the property value.
📄Description

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.

💡Examples
Case-sensitive name-based property access.
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'
🔗See Also
handlenelson.mixin.SetGetclassdef
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub