Mercurial > forge
changeset 12485:342c506f83fd octave-forge
Transposed output of hist3.
author | asnelt |
---|---|
date | Mon, 12 May 2014 20:35:04 +0000 |
parents | b3898f56b7c2 |
children | c915e7aa49cd |
files | main/statistics/NEWS main/statistics/inst/hist3.m |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/main/statistics/NEWS Sun May 11 20:39:35 2014 +0000 +++ b/main/statistics/NEWS Mon May 12 20:35:04 2014 +0000 @@ -7,6 +7,8 @@ ** Added isempty check to kmeans. + ** Transposed output of hist3. + ** The following functions are new: cdf signtest ttest ttest2 vartest vartest2 ztest
--- a/main/statistics/inst/hist3.m Sun May 11 20:39:35 2014 +0000 +++ b/main/statistics/inst/hist3.m Mon May 12 20:35:04 2014 +0000 @@ -62,9 +62,12 @@ ybins=10; edges={}; M=varargin{1}; + if size(M,2) ~= 2 + error('X must be a two column marix'); + end if nargin>=2, % is a binning method is specified? - if isstr(varargin{2}), + if ischar(varargin{2}), method = find(strcmp(methods,varargin{2})); if isempty(method), error('Unknown property string'); @@ -96,7 +99,7 @@ hi = max(M); if isscalar(xbins) xbins = linspace(lo(1),hi(1),xbins+1); - xbins = (xbins(1:end-1)+xbins(2:end))/2; + xbins = (xbins(1:end-1)+xbins(2:end))/2; end if isscalar(ybins) ybins = linspace(lo(2),hi(2),ybins+1); @@ -126,10 +129,11 @@ xbins = (edges{1}(1:end-1)+edges{1}(2:end))/2; ybins = (edges{2}(1:end-1)+edges{2}(2:end))/2; end - counts = sparse(yidx,xidx,1,length(ybins), length(xbins), 'sum'); + + counts = sparse(yidx,xidx,1,length(ybins),length(xbins),'sum'); if nargout - varargout{1} = full(counts); + varargout{1} = full(counts'); if nargout>1 varargout{2} = {xbins,ybins}; end