Mercurial > forge
changeset 12346:d06c2bfedc90 octave-forge
Make princomp work with nargout < 2.
author | asnelt |
---|---|
date | Tue, 28 Jan 2014 22:36:24 +0000 |
parents | 34870d9205ac |
children | daafb4fde57b |
files | main/statistics/NEWS main/statistics/inst/princomp.m |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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