changeset 40:2adef77b98d0

Remove reference to global variable __current_colormap__; we need to do this because the semantics of global have changed so that a new symbol is created as empty if no default has been defined, which in turn means that exist("__some_global__") now returns true even if __some_global__ wasn't previously defined.
author pkienzle
date Thu, 30 Jan 2003 17:52:26 +0000
parents 1e648d79c0ef
children 5942b14d6c22
files autumn.m bone.m brighten.m cool.m copper.m flag.m hot.m hsv.m jet.m pink.m prism.m rainbow.m spring.m summer.m white.m winter.m
diffstat 16 files changed, 17 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/autumn.m
+++ b/autumn.m
@@ -27,14 +27,8 @@
 
 function map = autumn (number)
 
-  global __current_color_map__
-
   if (nargin == 0)
-    if exist("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("autumn: argument must be a scalar");
--- a/bone.m
+++ b/bone.m
@@ -27,14 +27,8 @@
 
 function map = bone (number)
 
-  global __current_color_map__
-
   if (nargin == 0)
-    if exist ("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("bone: argument must be a scalar");
--- a/brighten.m
+++ b/brighten.m
@@ -33,11 +33,9 @@
 
 function [Rmap] = brighten (m, beta)
 
-  global __current_color_map__
-
   if (nargin == 1)
     beta = m;
-    m = __current_color_map__;
+    m = colormap;
 
   elseif (nargin == 2)
     if ( (!is_matrix (m)) || (size (m, 2) != 3) )
@@ -59,7 +57,7 @@
   endif
 
   if (nargout == 0)
-    __current_color_map__ = m .^ gamma;
+    colormap (m .^ gamma);
   else
     Rmap = m .^ gamma;
   endif
--- a/cool.m
+++ b/cool.m
@@ -27,14 +27,8 @@
 
 function map = cool (number)
 
-  global __current_color_map__
-
   if (nargin == 0)
-    if exist ("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("cool: argument must be a scalar");
--- a/copper.m
+++ b/copper.m
@@ -27,14 +27,8 @@
 
 function map = copper (number)
 
-  global __current_color_map__
-
   if (nargin == 0)
-    if exist("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("copper: argument must be a scalar");
--- a/flag.m
+++ b/flag.m
@@ -30,14 +30,8 @@
 
 function map = flag (number)
 
-  global __current_color_map__
-
   if (nargin == 0)
-    if exist ("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("flag: argument must be a scalar");
--- a/hot.m
+++ b/hot.m
@@ -27,14 +27,8 @@
 
 function map = hot (number)
 
-  global __current_color_map__
-
   if (nargin == 0)
-    if exist("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1) 
 	if (! is_scalar (number))
       error ("hot: argument must be a scalar");
--- a/hsv.m
+++ b/hsv.m
@@ -26,14 +26,9 @@
 ## Author:  Kai Habel <kai.habel@gmx.de>
 
 function map = hsv (number)
-  global __current_color_map__
 
   if (nargin == 0)
-    if exist("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("hsv: argument must be a scalar");
--- a/jet.m
+++ b/jet.m
@@ -27,14 +27,8 @@
 
 function map = jet (number)
 
-  global __current_color_map__
-
   if (nargin == 0)
-    if (exist ("__current_color_map__"))
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("jet: argument must be a scalar");
--- a/pink.m
+++ b/pink.m
@@ -26,14 +26,9 @@
 ## Author:  Kai Habel <kai.habel@gmx.de>
 
 function map = pink (number)
-  global __current_color_map__
 
   if (nargin == 0)
-    if (exist ("__current_color_map__"))
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("pink: argument must be a scalar");
--- a/prism.m
+++ b/prism.m
@@ -26,14 +26,9 @@
 ## Author:  Kai Habel <kai.habel@gmx.de>
 
 function map = prism (number)
-  global __current_color_map__
 
   if (nargin == 0)
-    if exist("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("prism: argument must be a scalar");
--- a/rainbow.m
+++ b/rainbow.m
@@ -29,14 +29,8 @@
 ## this colormap is not part of matlab, it is like the prism
 ## colormap map but with a continuous map
 
-  global __current_color_map__
-
   if (nargin == 0)
-    if exist ("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("rainbow: argument must be a scalar");
--- a/spring.m
+++ b/spring.m
@@ -26,14 +26,9 @@
 ## Author:  Kai Habel <kai.habel@gmx.de>
 
 function map = spring (number)
-  global __current_color_map__
 
   if (nargin == 0)
-    if exist ("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("spring: argument must be a scalar");
--- a/summer.m
+++ b/summer.m
@@ -26,14 +26,9 @@
 ## Author:  Kai Habel <kai.habel@gmx.de>
 ## Date:  06/03/2000
 function map = summer (number)
-  global __current_color_map__
 
   if (nargin == 0)
-    if exist ("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("summer: argument must be a scalar");
--- a/white.m
+++ b/white.m
@@ -26,14 +26,9 @@
 ## Author:  Kai Habel <kai.habel@gmx.de>
 
 function map = white (number)
-  global __current_color_map__
 
   if (nargin == 0)
-    if exist ("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("white: argument must be a scalar");
--- a/winter.m
+++ b/winter.m
@@ -26,14 +26,9 @@
 ## Author:  Kai Habel <kai.habel@gmx.de>
 
 function map = winter (number)
-  global __current_color_map__
 
   if (nargin == 0)
-    if exist ("__current_color_map__")
-      number = rows (__current_color_map__);
-    else
-      number = 64;
-    endif
+    number = rows (colormap);
   elseif (nargin == 1)
     if (! is_scalar (number))
       error ("winter: argument must be a scalar");