# HG changeset patch # User asnelt # Date 1399926904 0 # Node ID 342c506f83fd260a08ee9bbd700d76e625331706 # Parent b3898f56b7c2564fbabff6795000f1787f433010 Transposed output of hist3. diff -r b3898f56b7c2 -r 342c506f83fd main/statistics/NEWS --- 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 diff -r b3898f56b7c2 -r 342c506f83fd main/statistics/inst/hist3.m --- 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