nelson.mixin.Scalar
Restrict a class to scalar instances.
📝Syntax
classdef MyClass < nelson.mixin.Scalar
📥Input Arguments
Parameter Description
obj an object of a class deriving from nelson.mixin.Scalar.
📤Output Arguments
Parameter Description
obj a scalar object instance.
📄Description

Derive from nelson.mixin.Scalar to declare that a class can only have scalar instances. Concatenating instances of the class into a non-scalar array, with [a b] or [a; b], raises an error with identifier Nelson:class:concatenationScalar.

Use this mixin for objects that represent a single entity and for which an array of objects has no meaning.

💡Examples
A scalar-only class.
classdef Config < nelson.mixin.Scalar
  properties
    Name = ''
  end
end
% a = [Config(), Config()]   % errors: objects can only be scalar
🔗See Also
classdef
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub