Commit 13409353 authored by Jakob Gabriel's avatar Jakob Gabriel
Browse files

quantity.Discrete.median: 'all' option

parent aa168de4
......@@ -2297,16 +2297,24 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
else
meanValue = reshape(mean(obj.on(), 1:obj(1).nargin), size(obj));
end
end
end % mean()
function medianValue = median(obj)
% meadin returns the meadin value of all elements of A over all
% variables as a double array.
% ATTENTION:
% median over multiple dimensions is only possible from MATLAB 2019a and above!
% TODO Update Matlab!
medianValue = reshape(median(obj.on(), 1:obj(1).nargin), size(obj));
end
function medianValue = median(obj, dim)
% median(dim) returns the median value over all domain as a double array
% of the size of obj.
%
% median(obj, 'all') returns the median value of all elements of A over all
% domain as a scalar double.
arguments
obj;
dim = [];
end
if strcmp(dim, "all")
medianValue = median(obj.on(), 'all');
else
medianValue = reshape(median(obj.on(), 1:obj(1).nargin), size(obj));
end
end % mean()
function value = obj2value(obj, myDomain)
% OBJ2VALUE make the stored data in valueDiscrete available for
......
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