from
Automatic UNITS conversion
by Riccardo Meldolesi
Eliminate UNITS related errors in code, through automatic units conversion
|
| noUnit(this) |
function this = noUnit(this)
% the direct instantiation of NOUNIT objects is deprecated.
% It should only be used used by the functions of the class UNIT
if nargin < 1
this = noUnit(1);
else
if strcmp(class(this),'noUnit')
return
elseif isnumeric(this)
[thisUnit,setComposite] = unit;
name = num2str(this);
value = this;
this = class(struct([]),'noUnit',thisUnit);
this.unit = setComposite(this.unit,this,name,value);
else
error('unexpected input type for ''unit'' class')
end
end
|
|
Contact us at files@mathworks.com