reporting: on error reading user options, print actual option passed not lowercase version of it

time-shift
Houtan Bastani 2013-05-14 17:22:24 +02:00
parent d6210a4a34
commit cbd43ee9df
7 changed files with 14 additions and 24 deletions

View File

@ -77,13 +77,12 @@ elseif nargin > 1
% overwrite default values
for pair = reshape(varargin, 2, [])
field = lower(pair{1});
ind = strmatch(field, lower(optNames), 'exact');
ind = strmatch(lower(pair{1}), lower(optNames), 'exact');
assert(isempty(ind) || length(ind) == 1);
if ~isempty(ind)
o.(optNames{ind}) = pair{2};
else
error('@graph.graph: %s is not a recognized option.', field);
error('@graph.graph: %s is not a recognized option.', pair{1});
end
end
end

View File

@ -52,13 +52,12 @@ elseif nargin > 1
% overwrite default values
for pair = reshape(varargin, 2, [])
field = lower(pair{1});
ind = strmatch(field, lower(optNames), 'exact');
ind = strmatch(lower(pair{1}), lower(optNames), 'exact');
assert(isempty(ind) || length(ind) == 1);
if ~isempty(ind)
o.(optNames{ind}) = pair{2};
else
error('@page.page: %s is not a recognized option.', field);
error('@page.page: %s is not a recognized option.', pair{1});
end
end
end

View File

@ -58,14 +58,12 @@ elseif nargin > 1
% overwrite default values
for pair = reshape(varargin, 2, [])
field = lower(pair{1});
ind = strmatch(field, lower(optNames), 'exact');
ind = strmatch(lower(pair{1}), lower(optNames), 'exact');
assert(isempty(ind) || length(ind) == 1);
if ~isempty(ind)
o.(optNames{ind}) = pair{2};
else
error('@report.report: %s is not a recognized option.', ...
field);
error('@report.report: %s is not a recognized option.', pair{1});
end
end
end

View File

@ -40,14 +40,12 @@ elseif nargin > 1
% overwrite default values
for pair = reshape(varargin, 2, [])
field = lower(pair{1});
ind = strmatch(field, lower(optNames), 'exact');
ind = strmatch(lower(pair{1}), lower(optNames), 'exact');
assert(isempty(ind) || length(ind) == 1);
if ~isempty(ind)
o.(optNames{ind}) = pair{2};
else
error('@section.section: %s is not a recognized option.', ...
field);
error('@section.section: %s is not a recognized option.', pair{1});
end
end
end

View File

@ -65,13 +65,12 @@ elseif nargin > 1
% overwrite default values
for pair = reshape(varargin, 2, [])
field = lower(pair{1});
ind = strmatch(field, lower(optNames), 'exact');
ind = strmatch(lower(pair{1}), lower(optNames), 'exact');
assert(isempty(ind) || length(ind) == 1);
if ~isempty(ind)
o.(optNames{ind}) = pair{2};
else
error('@series.series: %s is not a recognized option.', field);
error('@series.series: %s is not a recognized option.', pair{1});
end
end
end

View File

@ -62,14 +62,12 @@ elseif nargin > 1
% overwrite default values
for pair = reshape(varargin, 2, [])
field = lower(pair{1});
ind = strmatch(field, lower(optNames), 'exact');
ind = strmatch(lower(pair{1}), lower(optNames), 'exact');
assert(isempty(ind) || length(ind) == 1);
if ~isempty(ind)
o.(optNames{ind}) = pair{2};
else
error('%s is not a recognized option to the Table constructor.', ...
field);
error('%s is not a recognized option to the Table constructor.', pair{1});
end
end
end

View File

@ -48,13 +48,12 @@ elseif nargin > 1
% overwrite default values
for pair = reshape(varargin, 2, [])
field = lower(pair{1});
ind = strmatch(field, lower(optNames), 'exact');
ind = strmatch(lower(pair{1}), lower(optNames), 'exact');
assert(isempty(ind) || length(ind) == 1);
if ~isempty(ind)
o.(optNames{ind}) = pair{2};
else
error('@vspace.vspace: %s is not a recognized option.', field);
error('@vspace.vspace: %s is not a recognized option.', pair{1});
end
end
end