changeset 495:21a408d3da04

imhist: bug fix when n is not specified, and useing_colormap was not initialized
author carandraug
date Thu, 10 Nov 2011 19:44:35 +0000
parents fdfaaf68dab0
children fa4f6291d232
files inst/imhist.m
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/inst/imhist.m
+++ b/inst/imhist.m
@@ -59,7 +59,6 @@
         warning ("largest index exceeds length of colormap");
       endif
     elseif (isnumeric (b) && isscalar (b) && fix(b) == b)
-      using_colormap = false;
       bins = 0:b-1;
     else
       error ("second argument should either be a positive integer scalar or a colormap");
@@ -75,14 +74,14 @@
   ## cases and use only the "new" code when "using_colormap" is false
   ## Carnë Draug 10/11/2011
   if (nargout == 0)
-    if (using_colormap)
+    if (exist ("using_colormap", "var") && using_colormap)
       hist (I(:), bins);
     else
       [nn] = histc (I(:), bins);
       stem (bins, nn);
     endif
   else
-    if (using_colormap)
+    if (exist ("using_colormap", "var") && using_colormap)
       [nn,bins] = hist (I(:), bins);
     else
       [nn] = histc (I(:), bins);