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

Changed isempty check due to the previous one checked if there are discrete...

Changed isempty check due to the previous one checked if there are discrete values what could lead to infinite loop.
parent 90de42ca
......@@ -210,7 +210,10 @@ classdef (InferiorClasses = {?quantity.Symbolic, ?quantity.Operator}) Discrete
[obj.grid] = deal(grid);
function valueDiscrete = get.valueDiscrete(obj)
if isempty(obj.valueDiscrete)
% check if the value discrete for this object
% has already been computed.
empty = reshape(cellfun('isempty', {obj(:).valueDiscrete}), size(obj));
if any(empty(:))
obj.valueDiscrete = obj.on(obj.grid);
valueDiscrete = obj.valueDiscrete;
......@@ -533,8 +536,6 @@ classdef (InferiorClasses = {?quantity.Symbolic, ?quantity.Operator}) Discrete
[fineGrid, fineGridName] = getFinestGrid(objCell{~isEmpty});
for it = 1 : (numel(varargin) + 1) % +1 because the first entry is a
assert(all(strcmp(unique(fineGridName), unique(objCell{it}(1).gridName))), ...
'gridNames of objects that are concatenated must be equal');
objCell{it} = objCell{it}.changeGrid(fineGrid, fineGridName);
......@@ -855,7 +856,12 @@ classdef (InferiorClasses = {?quantity.Symbolic, ?quantity.Operator}) Discrete
function n = nargin(obj)
% FIXME: check if all funtions in this object have the same
% number of input values.
n = numel(obj(1).gridName);
% FIXME: for some combinations of constant objects, it seems to be
% possible, that the quantity has a gridName but no grid.
% Actually this should not be allowed. This is quick and dirty
% work around.
n = min(numel(obj(1).gridName), numel(obj(1).grid));
function d = gridDiff(obj)
......@@ -1463,14 +1469,6 @@ classdef (InferiorClasses = {?quantity.Symbolic, ?quantity.Operator}) Discrete
% check if there is already an object
empty = any(size(obj) == 0);
% if there is an object, check if the object has an
% valueContinuous
if ~empty
empty = reshape(cellfun('isempty', {obj(:).valueDiscrete}), size(obj));
empty = any(empty(:));
function P = ztzTimes(a, b)
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