Commit ad211f18 authored by Ferdinand Fischer's avatar Ferdinand Fischer
Browse files

Let quantity.Discrete/subs handle empty quantities

parent b96aca6b
......@@ -1042,22 +1042,23 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
[newValues, oldDomainName] = quantity.Discrete.subsParser(oldDomainName, varargin);
solution = copy(obj);
for it = 1 : numel(oldDomainName)
if isstring(newValues{it})
% if newValues{it} is a string, it is converted in a domain, to use the same
% implementation as for quantity.Domain-objects in newValues.
newValues{it} = solution(1).domain.find(oldDomainName(it)).rename(newValues{it}, oldDomainName(it));
end
if isnumeric(newValues{it})
solution = solution.subsNumeric(oldDomainName(it), newValues{it});
else
solution = solution.subsDomain(oldDomainName(it), newValues{it});
end % if-else
end % for it = 1 : numel(oldDomainName)
if ~isempty(solution)
for it = 1 : numel(oldDomainName)
if isstring(newValues{it})
% if newValues{it} is a string, it is converted in a domain, to use the same
% implementation as for quantity.Domain-objects in newValues.
newValues{it} = solution(1).domain.find(oldDomainName(it)).rename(newValues{it}, oldDomainName(it));
end
if isnumeric(newValues{it})
solution = solution.subsNumeric(oldDomainName(it), newValues{it});
else
solution = solution.subsDomain(oldDomainName(it), newValues{it});
end % if-else
end % for it = 1 : numel(oldDomainName)
end % if - isempty
end % subs()
function solution = subsNumeric(obj, oldDomainName, value)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment