diff --git a/src/@graph/graph.m b/src/@graph/graph.m index b1f294015f480c8dc0524a3ac7ef6ea4e8e3f791..16c7bbf64b75ec4c6319b2c5807e053a87bcdd7f 100644 --- a/src/@graph/graph.m +++ b/src/@graph/graph.m @@ -14,7 +14,7 @@ function o = graph(varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-2016 Dynare Team % % This file is part of Dynare. % @@ -152,20 +152,20 @@ assert(any(strcmp(o.axisShape, {'box', 'L'})), ['@graph.graph: axisShape ' ... valid_legend_locations = ... {'south west','south east','north west','north east','outer north east'}; assert(any(strcmp(o.legendLocation, valid_legend_locations)), ... - ['@graph.graph: legendLocation must be one of ' strjoin(valid_legend_locations, ', ')]); + ['@graph.graph: legendLocation must be one of ' addCommasToCellStr(valid_legend_locations)]); valid_font_sizes = {'tiny', 'scriptsize', 'footnotesize', 'small', ... 'normalsize', 'large', 'Large', 'LARGE', 'huge', 'Huge'}; assert(any(strcmp(o.legendFontSize, valid_font_sizes)), ... - ['@graph.graph: legendFontSize must be one of ' strjoin(valid_font_sizes, ', ')]); + ['@graph.graph: legendFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); assert(any(strcmp(o.titleFontSize, valid_font_sizes)), ... - ['@graph.graph: titleFontSize must be one of ' strjoin(valid_font_sizes, ', ')]); + ['@graph.graph: titleFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); assert(any(strcmp(o.tickFontSize, valid_font_sizes)), ... - ['@graph.graph: tickFontSize must be one of ' strjoin(valid_font_sizes, ', ')]); + ['@graph.graph: tickFontSize must be one of ' addCommasToCellStr(valid_font_sizes)]); valid_legend_orientations = {'vertical', 'horizontal'}; assert(any(strcmp(o.legendOrientation, valid_legend_orientations)), ... - ['@graph.graph: legendOrientation must be one of ' strjoin(valid_legend_orientations, ', ')]); + ['@graph.graph: legendOrientation must be one of ' addCommasToCellStr(valid_legend_orientations)]); assert(isempty(o.shade) || (isdates(o.shade) && o.shade.ndat >= 2), ... ['@graph.graph: shade is specified as a dates range, e.g. ' ... diff --git a/src/@page/page.m b/src/@page/page.m index ba317ba84c28287ad55411163d90691e67499bd4..9c0249e5e37f8fa62eac2b20689f57c005500df8 100644 --- a/src/@page/page.m +++ b/src/@page/page.m @@ -12,7 +12,7 @@ function o = page(varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-2016 Dynare Team % % This file is part of Dynare. % @@ -89,11 +89,11 @@ assert(ischar(o.latex), ... '@page.page: latex must be a string'); valid_paper = {'a4', 'letter'}; assert(any(strcmp(o.paper, valid_paper)), ... - ['@page.page: paper must be one of ' strjoin(valid_paper, ', ')]); + ['@page.page: paper must be one of ' addCommasToCellStr(valid_paper)]); valid_orientation = {'portrait', 'landscape'}; assert(any(strcmp(o.orientation, valid_orientation)), ... - ['@page.page: orientation must be one of ' strjoin(valid_orientation, ', ')]); + ['@page.page: orientation must be one of ' addCommasToCellStr(valid_orientation)]); if ischar(o.footnote) o.footnote = {o.footnote}; diff --git a/src/@report/report.m b/src/@report/report.m index 9792661846723c861980504c53c8902ebb4e6c7f..34b0b8c69bb4b460716983e0991c98de768b6806 100644 --- a/src/@report/report.m +++ b/src/@report/report.m @@ -13,7 +13,7 @@ function o = report(varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-2016 Dynare Team % % This file is part of Dynare. % @@ -79,15 +79,15 @@ assert(isfloat(o.margin) && o.margin > 0, '@report.report: margin must be a floa assert(ischar(o.header), '@report.report: header must be a string'); valid_margin_unit = {'cm', 'in'}; assert(any(strcmp(o.marginUnit, valid_margin_unit)), ... - ['@report.report: marginUnit must be one of ' strjoin(valid_margin_unit, ', ')]); + ['@report.report: marginUnit must be one of ' addCommasToCellStr(valid_margin_unit)]); valid_paper = {'a4', 'letter'}; assert(any(strcmp(o.paper, valid_paper)), ... - ['@report.report: paper must be one of ' strjoin(valid_paper, ', ')]); + ['@report.report: paper must be one of ' addCommasToCellStr(valid_paper)]); valid_orientation = {'portrait', 'landscape'}; assert(any(strcmp(o.orientation, valid_orientation)), ... - ['@report.report: orientation must be one of ' strjoin(valid_orientation, ', ')]); + ['@report.report: orientation must be one of ' addCommasToCellStr(valid_orientation)]); % Create report object o = class(o, 'report'); diff --git a/src/@report_series/writeSeriesForGraph.m b/src/@report_series/writeSeriesForGraph.m index d52bfaced4b2e9d9ad62f7bd49ca597128cb9ce0..3bd072a6125e81b83fa4bc15ff7c02fe1e2888bb 100644 --- a/src/@report_series/writeSeriesForGraph.m +++ b/src/@report_series/writeSeriesForGraph.m @@ -13,7 +13,7 @@ function o = writeSeriesForGraph(o, fid, xrange, series_num) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2014-2015 Dynare Team +% Copyright (C) 2014-2016 Dynare Team % % This file is part of Dynare. % @@ -61,7 +61,7 @@ valid_graphMarker = {'x', '+', '-', '|', 'o', 'asterisk', 'star', '10-pointed st 'halfsquare left*','Mercedes star','Mercedes star flipped','halfcircle',... 'halfcircle*','pentagon','pentagon star'}; assert(isempty(o.graphMarker) || any(strcmp(o.graphMarker, valid_graphMarker)), ... - ['@report_series.writeSeriesForGraph: graphMarker must be one of ' strjoin(valid_graphMarker, ', ')]); + ['@report_series.writeSeriesForGraph: graphMarker must be one of ' addCommasToCellStr(valid_graphMarker)]); assert(ischar(o.graphMarkerEdgeColor), '@report_series.writeSeriesForGraph: graphMarkerEdgeColor must be a string'); assert(ischar(o.graphMarkerFaceColor), '@report_series.writeSeriesForGraph: graphMarkerFaceColor must be a string'); diff --git a/src/addCommasToCellStr.m b/src/addCommasToCellStr.m new file mode 100644 index 0000000000000000000000000000000000000000..de96d4e08c3e6fa822da3255ebae97623ea39398 --- /dev/null +++ b/src/addCommasToCellStr.m @@ -0,0 +1,41 @@ +function str = addCommasToCellStr(cs) +%function ncs = addCommasToCellStr(cs) +% Add commas between entries of cell string and return a sting +% +% INPUTS +% cs [Cell Arrays of Strings] Cell string in which to intersperse commas +% +% OUTPUTS +% str [string] cs with commas interspersed +% +% SPECIAL REQUIREMENTS +% none + +% Copyright (C) 2016 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +assert(iscellstr(cs), 'addCommasToCellStr: cs should be a cell array of strings.'); + +str = ''; +for i=1:length(cs) + if i < length(cs) + str = [str cs{i} ', ']; + else + str = [str cs{i}]; + end +end +end \ No newline at end of file