Skip to content
Snippets Groups Projects
Commit 3ba1dcd4 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

reporting: @table, @graph: require data to be dynSeries, simplify checks

parent 6d0cd7ba
Branches
Tags
No related merge requests found
......@@ -49,10 +49,6 @@ end
%set(h, 'PaperPositionMode', 'auto');
%set(h, 'units', 'normalized', 'outerposition', [0 0 1 1]);
if length(o.data) > 1
o.data = [o.data{:}];
end
if isempty(o.seriestouse)
ds = o.data;
else
......
......@@ -112,26 +112,10 @@ assert(isempty(o.yrange) || (isfloat(o.yrange) && length(o.yrange) == 2 && ...
o.yrange(1) < o.yrange(2)), ...
['@graph.graph: yrange is specified an array with two float entries, ' ...
'the lower bound and upper bound.']);
assert(~isempty(o.data), '@graph.graph: must provide data');
msg = ['@graph.graph: data must either be a dynSeries or a cell array of ' ...
'dynSeries'];
if length(o.data) == 1
assert(isa(o.data, 'dynSeries'), msg);
else
assert(iscell(o.data), msg);
for i=1:length(o.data)
assert(isa(o.data{i}, 'dynSeries'), msg);
end
end
msg = ['@graph.graph: series to use must be a cell array of string(s)'];
if ~isempty(o.seriestouse)
assert(iscell(o.seriestouse), msg);
for i=1:length(o.seriestouse)
assert(ischar(o.seriestouse{i}), msg);
end
end
assert(~isempty(o.data) && isa(o.data, 'dynSeries'), ['@graph.graph: must ' ...
'provide data as a dynSeries']);
assert(isempty(o.seriestouse) || iscellstr(o.seriestouse), ['@graph.graph: ' ...
'series to use must be a cell array of string(s)']);
% Create graph object
o = class(o, 'graph');
......
......@@ -78,26 +78,10 @@ assert(isint(o.precision), '@table.table: precision must be an int');
assert(isempty(o.range) || (isa(o.range, 'dynDates') && o.range.ndat >= 2), ...
['@table.table: range is specified as a dynDates range, e.g. ' ...
'''dynDates(''1999q1''):dynDates(''1999q3'')''.']);
assert(~isempty(o.data), '@table.table: must provide data');
msg = ['@table.table: data must either be a dynSeries or a cell array of ' ...
'dynSeries'];
if length(o.data) == 1
assert(isa(o.data, 'dynSeries'), msg);
else
assert(iscell(o.data), msg);
for i=1:length(o.data)
assert(isa(o.data{i}, 'dynSeries'), msg);
end
end
msg = ['@table.table: series to use must be a cell array of string(s)'];
if ~isempty(o.seriestouse)
assert(iscell(o.seriestouse), msg);
for i=1:length(o.seriestouse)
assert(ischar(o.seriestouse{i}), msg);
end
end
assert(~isempty(o.data) && isa(o.data, 'dynSeries'), ['@table.table: must ' ...
'provide data as a dynSeries']);
assert(isempty(o.seriestouse) || iscellstr(o.seriestouse), ['@table.table: ' ...
'series to use must be a cell array of string(s)']);
% Create table object
o = class(o, 'table');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment