# HG changeset patch # User asnelt # Date 1390948584 0 # Node ID d06c2bfedc90f1008e85adc51950e0dd18a32a28 # Parent 34870d9205ac85e5434730a62921c576029db460 Make princomp work with nargout < 2. diff -r 34870d9205ac -r d06c2bfedc90 main/statistics/NEWS --- a/main/statistics/NEWS Tue Jan 28 22:08:22 2014 +0000 +++ b/main/statistics/NEWS Tue Jan 28 22:36:24 2014 +0000 @@ -1,6 +1,8 @@ Summary of important user-visible changes for statistics 1.2.4: ------------------------------------------------------------------- + ** Make princomp work with nargout < 2. + ** The following functions are new: cdf diff -r 34870d9205ac -r d06c2bfedc90 main/statistics/inst/princomp.m --- a/main/statistics/inst/princomp.m Tue Jan 28 22:08:22 2014 +0000 +++ b/main/statistics/inst/princomp.m Tue Jan 28 22:36:24 2014 +0000 @@ -99,10 +99,11 @@ endif - # This is the same as the eigenvalues of the covariance matrix of X - latent = (diag(S'*S)/(size(Xcentered,1)-1))(1:r); + if nargout > 2 - if nargout > 2 + # This is the same as the eigenvalues of the covariance matrix of X + latent = (diag(S'*S)/(size(Xcentered,1)-1))(1:r); + if !(nargin == 2 && strcmpi ( varargin{:} , "econ")) latent= [latent;zeros(nvars-r,1)]; endif