From: <jpi...@us...> - 2012-09-19 09:23:44
|
Revision: 11052 http://octave.svn.sourceforge.net/octave/?rev=11052&view=rev Author: jpicarbajal Date: 2012-09-19 09:23:37 +0000 (Wed, 19 Sep 2012) Log Message: ----------- statistics: slight improvement to dendogram. Output args and figure handling still needs work. Modified Paths: -------------- trunk/octave-forge/main/statistics/inst/dendogram.m Modified: trunk/octave-forge/main/statistics/inst/dendogram.m =================================================================== --- trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-18 22:39:31 UTC (rev 11051) +++ trunk/octave-forge/main/statistics/inst/dendogram.m 2012-09-19 09:23:37 UTC (rev 11052) @@ -14,7 +14,7 @@ %% along with this program. If not, see <http://www.gnu.org/licenses/>. %% -*- texinfo -*- -%% @deftypefn {Function File} {@var{h} = } dendogram (@var{tree}) +%% @deftypefn {Function File} {@var{p} = } dendogram (@var{tree}) %% Plots a dendogram using the output of function @command{linkage}. %% %% TODO: Return handle to lines to set properties @@ -23,7 +23,7 @@ %% @seealso{linkage} %% @end deftypefn -function h = dendogram (tree) +function p = dendogram (tree) [m d] = size (tree); if d != 3 @@ -70,10 +70,10 @@ tmp = line (x', tree(:,[3 3])'); % plot vertical lines - for i=1:nc - [ind,~] = find (tree(:,1:2)==i); - tmp = line (p([i; i],1),[p(i,2); tree(ind,3)]); - end + [~,tf] = ismember (1:nc, tree(:,1:2)); + [ind,~] = ind2sub (size (tree(:,1:2)), tf); + y = [p(1:nc,2) tree(ind,3)]; + tmp = line ([p(1:nc,1) p(1:nc,1)]',y'); xticks = 1:n; xl_txt = arrayfun (@num2str, labels,"uniformoutput",false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |