From 63054a5728ae9afa91e421b8f72a6d85dbaaddb0 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 22 Jan 2019 00:05:08 +0100 Subject: [PATCH] olsgibbs: fix checks of input arguments --- matlab/olsgibbs.m | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/matlab/olsgibbs.m b/matlab/olsgibbs.m index 457a04a2c..455154d8a 100644 --- a/matlab/olsgibbs.m +++ b/matlab/olsgibbs.m @@ -69,8 +69,6 @@ if ~isvector(BetaPriorExpectation) else if ~isempty(BetaPriorExpectation) BetaPriorExpectation = transpose(BetaPriorExpectation(:)); - else - end end @@ -94,19 +92,19 @@ if ~isint(ndraws) error('The 7th argument (ndraws) must be an integer') end -if nargin == 7 +if nargin <= 7 discarddraws = 0; else if ~isint(discarddraws) error('The 8th argument (discardeddraws), if provided, must be an integer') else - if ~(discarddraws= ndraws error('The 8th argument (discardeddraws) must be smaller than the 7th argument (ndraws)') end end end -if nargin == 8 +if nargin <= 8 thin = 1; else if ~isint(thin) @@ -114,12 +112,12 @@ else end end -if nargin == 9 +if nargin <= 9 fitted_names_dict = {}; else - if (~isempty(fitted_names_dict) && ... + if ~isempty(fitted_names_dict) && ... (~iscell(fitted_names_dict) || ... - (size(fitted_names_dict, 2) < 2 || size(fitted_names_dict, 2) > 3))) + (size(fitted_names_dict, 2) < 2 || size(fitted_names_dict, 2) > 3)) error('The 10th argument must be an Nx2 or Nx3 cell array'); end end