changeset 17211:87ba70043bfc

Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations. * scripts/plot/area.m, scripts/plot/axis.m, scripts/plot/caxis.m, scripts/plot/comet.m, scripts/plot/comet3.m, scripts/plot/compass.m, scripts/plot/contour.m, scripts/plot/contour3.m, scripts/plot/contourf.m, scripts/plot/cylinder.m, scripts/plot/ellipsoid.m, scripts/plot/errorbar.m, scripts/plot/feather.m, scripts/plot/fill.m, scripts/plot/loglog.m, scripts/plot/loglogerr.m, scripts/plot/mesh.m, scripts/plot/meshc.m, scripts/plot/meshz.m, scripts/plot/pcolor.m, scripts/plot/pie.m, scripts/plot/pie3.m, scripts/plot/plot.m, scripts/plot/plot3.m, scripts/plot/polar.m, scripts/plot/private/__bar__.m, scripts/plot/private/__ezplot__.m, scripts/plot/private/__stem__.m, scripts/plot/quiver.m, scripts/plot/quiver3.m, scripts/plot/rectangle.m, scripts/plot/ribbon.m, scripts/plot/rose.m, scripts/plot/scatter.m, scripts/plot/scatter3.m, scripts/plot/semilogx.m, scripts/plot/semilogxerr.m, scripts/plot/semilogy.m, scripts/plot/semilogyerr.m, scripts/plot/slice.m, scripts/plot/sphere.m, scripts/plot/stairs.m, scripts/plot/surf.m, scripts/plot/surfc.m, scripts/plot/surfl.m, scripts/plot/surfnorm.m, scripts/time/datetick.m: Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
author Rik <rik@octave.org>
date Fri, 09 Aug 2013 19:26:55 -0700
parents 73dd413f2c3e
children 9336d0e1d1ec
files scripts/plot/area.m scripts/plot/axis.m scripts/plot/caxis.m scripts/plot/comet.m scripts/plot/comet3.m scripts/plot/compass.m scripts/plot/contour.m scripts/plot/contour3.m scripts/plot/contourf.m scripts/plot/cylinder.m scripts/plot/ellipsoid.m scripts/plot/errorbar.m scripts/plot/feather.m scripts/plot/fill.m scripts/plot/loglog.m scripts/plot/loglogerr.m scripts/plot/mesh.m scripts/plot/meshc.m scripts/plot/meshz.m scripts/plot/pcolor.m scripts/plot/pie.m scripts/plot/pie3.m scripts/plot/plot.m scripts/plot/plot3.m scripts/plot/polar.m scripts/plot/private/__bar__.m scripts/plot/private/__ezplot__.m scripts/plot/private/__stem__.m scripts/plot/quiver.m scripts/plot/quiver3.m scripts/plot/rectangle.m scripts/plot/ribbon.m scripts/plot/rose.m scripts/plot/scatter.m scripts/plot/scatter3.m scripts/plot/semilogx.m scripts/plot/semilogxerr.m scripts/plot/semilogy.m scripts/plot/semilogyerr.m scripts/plot/slice.m scripts/plot/sphere.m scripts/plot/stairs.m scripts/plot/surf.m scripts/plot/surfc.m scripts/plot/surfl.m scripts/plot/surfnorm.m scripts/time/datetick.m
diffstat 47 files changed, 188 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/area.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/area.m	Fri Aug 09 19:26:55 2013 -0700
@@ -103,7 +103,10 @@
     x = repmat (x(:), 1, columns (y));
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     htmp = __area__ (hax, x, y, bv, args{:});
--- a/scripts/plot/axis.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/axis.m	Fri Aug 09 19:26:55 2013 -0700
@@ -135,7 +135,10 @@
 
   [hax, varargin, nargin] = __plt_get_axis_arg__ ("axis", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     if (isempty (hax))
       hax = gca ();
--- a/scripts/plot/caxis.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/caxis.m	Fri Aug 09 19:26:55 2013 -0700
@@ -43,7 +43,10 @@
 
   [hax, varargin, nargin] = __plt_get_axis_arg__ ("caxis", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     if (isempty (hax))
       hax = gca ();
--- a/scripts/plot/comet.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/comet.m	Fri Aug 09 19:26:55 2013 -0700
@@ -57,7 +57,10 @@
     p = varargin{3};
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     limits = [min(x), max(x), min(y), max(y)];
--- a/scripts/plot/comet3.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/comet3.m	Fri Aug 09 19:26:55 2013 -0700
@@ -59,7 +59,10 @@
     p = varargin{4};
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     limits = [min(x), max(x), min(y), max(y), min(z), max(z)];
--- a/scripts/plot/compass.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/compass.m	Fri Aug 09 19:26:55 2013 -0700
@@ -99,7 +99,10 @@
        ytmp - u * arrowsize / 3];
   [r, p] = cart2pol (x, y);
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     hlist = polar (r, p, line_spec);
--- a/scripts/plot/contour.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/contour.m	Fri Aug 09 19:26:55 2013 -0700
@@ -63,7 +63,10 @@
 
   [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     
--- a/scripts/plot/contour3.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/contour3.m	Fri Aug 09 19:26:55 2013 -0700
@@ -65,7 +65,10 @@
 
   [hax, varargin, nargin] = __plt_get_axis_arg__ ("contour3", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     
--- a/scripts/plot/contourf.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/contourf.m	Fri Aug 09 19:26:55 2013 -0700
@@ -64,7 +64,10 @@
 
   [hax, varargin] = __plt_get_axis_arg__ ("contour", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     
--- a/scripts/plot/cylinder.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/cylinder.m	Fri Aug 09 19:26:55 2013 -0700
@@ -83,7 +83,10 @@
     yy = y;
     zz = z;
   else
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
     
--- a/scripts/plot/ellipsoid.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/ellipsoid.m	Fri Aug 09 19:26:55 2013 -0700
@@ -74,7 +74,10 @@
     yy = y;
     zz = z;
   else
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
     
--- a/scripts/plot/errorbar.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/errorbar.m	Fri Aug 09 19:26:55 2013 -0700
@@ -130,7 +130,10 @@
 
   [hax, varargin] = __plt_get_axis_arg__ ("errorbar", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/feather.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/feather.m	Fri Aug 09 19:26:55 2013 -0700
@@ -98,7 +98,10 @@
   y = [zeros(1, n); yend; ytmp  + u * arrowsize / 3; yend; ...
        ytmp - u * arrowsize / 3];
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     hlist = plot (x, y, line_spec, [1, n], [0, 0], line_spec);
--- a/scripts/plot/fill.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/fill.m	Fri Aug 09 19:26:55 2013 -0700
@@ -72,7 +72,10 @@
   hlist = [];
   iargs = __find_patches__ (varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     old_nxtplt = get (hax, "nextplot");
--- a/scripts/plot/loglog.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/loglog.m	Fri Aug 09 19:26:55 2013 -0700
@@ -45,7 +45,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/loglogerr.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/loglogerr.m	Fri Aug 09 19:26:55 2013 -0700
@@ -48,7 +48,10 @@
 
   [hax, varargin] = __plt_get_axis_arg__ ("loglogerr", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/mesh.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/mesh.m	Fri Aug 09 19:26:55 2013 -0700
@@ -63,7 +63,10 @@
 
   [hax, varargin, nargin] = __plt_get_axis_arg__ ("mesh", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/meshc.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/meshc.m	Fri Aug 09 19:26:55 2013 -0700
@@ -61,7 +61,10 @@
 
   [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshc", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/meshz.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/meshz.m	Fri Aug 09 19:26:55 2013 -0700
@@ -111,7 +111,10 @@
     varargin(charidx) = c;
   endif
     
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     htmp = mesh (x, y, z, varargin{charidx:end});
--- a/scripts/plot/pcolor.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/pcolor.m	Fri Aug 09 19:26:55 2013 -0700
@@ -74,7 +74,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     htmp = surface (x, y, z, c);
--- a/scripts/plot/pie.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/pie.m	Fri Aug 09 19:26:55 2013 -0700
@@ -60,7 +60,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     htmp = __pie__ ("pie", hax, varargin{:});
--- a/scripts/plot/pie3.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/pie3.m	Fri Aug 09 19:26:55 2013 -0700
@@ -61,7 +61,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     htmp = __pie__ ("pie3", hax, varargin{:});
--- a/scripts/plot/plot.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/plot.m	Fri Aug 09 19:26:55 2013 -0700
@@ -206,7 +206,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     htmp = __plt__ ("plot", hax, varargin{:});
--- a/scripts/plot/plot3.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/plot3.m	Fri Aug 09 19:26:55 2013 -0700
@@ -109,7 +109,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/polar.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/polar.m	Fri Aug 09 19:26:55 2013 -0700
@@ -49,7 +49,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/private/__bar__.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/private/__bar__.m	Fri Aug 09 19:26:55 2013 -0700
@@ -149,7 +149,10 @@
   yb = reshape (yb, [4, numel(yb) / 4 / ycols, ycols]);
 
   if (nargout < 2)
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
 
--- a/scripts/plot/private/__ezplot__.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/private/__ezplot__.m	Fri Aug 09 19:26:55 2013 -0700
@@ -427,7 +427,10 @@
   until (domain_ok)
 
   ## Now, actually call the correct plot function with valid data and domain.
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     if (iscontour)
--- a/scripts/plot/private/__stem__.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/private/__stem__.m	Fri Aug 09 19:26:55 2013 -0700
@@ -37,7 +37,10 @@
   [x, y, z, dofill, llc, ls, mmc, ms, varargin] = ...
       check_stem_arg (have_z, varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     hold_state = get (hax, "nextplot");
--- a/scripts/plot/quiver.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/quiver.m	Fri Aug 09 19:26:55 2013 -0700
@@ -68,7 +68,10 @@
   if (nargin < 2)
     print_usage ();
   else
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
       htmp = __quiver__ (hax, false, varargin{:});
--- a/scripts/plot/quiver3.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/quiver3.m	Fri Aug 09 19:26:55 2013 -0700
@@ -71,7 +71,10 @@
   if (nargin < 2)
     print_usage ();
   else
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
       htmp = __quiver__ (hax, true, varargin{:});
--- a/scripts/plot/rectangle.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/rectangle.m	Fri Aug 09 19:26:55 2013 -0700
@@ -60,7 +60,10 @@
 
   [hax, varargin] = __plt_get_axis_arg__ ("rectangle", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/ribbon.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/ribbon.m	Fri Aug 09 19:26:55 2013 -0700
@@ -76,7 +76,10 @@
     endif
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/rose.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/rose.m	Fri Aug 09 19:26:55 2013 -0700
@@ -90,7 +90,10 @@
   r(3:4:end, :) = nn;
 
   if (nargout < 2)
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
       htmp = polar (th, r);
--- a/scripts/plot/scatter.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/scatter.m	Fri Aug 09 19:26:55 2013 -0700
@@ -75,7 +75,10 @@
   if (nargin < 2)
     print_usage ();
   else
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
       
--- a/scripts/plot/scatter3.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/scatter3.m	Fri Aug 09 19:26:55 2013 -0700
@@ -72,7 +72,10 @@
   if (nargin < 2)
     print_usage ();
   else
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
       
--- a/scripts/plot/semilogx.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/semilogx.m	Fri Aug 09 19:26:55 2013 -0700
@@ -45,7 +45,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/semilogxerr.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/semilogxerr.m	Fri Aug 09 19:26:55 2013 -0700
@@ -50,7 +50,10 @@
 
   [hax, varargin] = __plt_get_axis_arg__ ("semilogxerr", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/semilogy.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/semilogy.m	Fri Aug 09 19:26:55 2013 -0700
@@ -45,7 +45,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/semilogyerr.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/semilogyerr.m	Fri Aug 09 19:26:55 2013 -0700
@@ -50,7 +50,10 @@
 
   [hax, varargin] = __plt_get_axis_arg__ ("semilogyerr", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/slice.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/slice.m	Fri Aug 09 19:26:55 2013 -0700
@@ -133,7 +133,10 @@
     error ("slice: dimensional mismatch for (XI, YI, ZI) or (SX, SY, SZ)");
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/sphere.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/sphere.m	Fri Aug 09 19:26:55 2013 -0700
@@ -71,7 +71,10 @@
     yy = y;
     zz = z;
   else
-    oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
     unwind_protect
       hax = newplot (hax);
     
--- a/scripts/plot/stairs.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/stairs.m	Fri Aug 09 19:26:55 2013 -0700
@@ -74,7 +74,10 @@
     if (nargout > 1)
       [h, xs, ys] = __stairs__ (false, varargin{:});
     else
-      oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
       unwind_protect
         hax = newplot (hax);
         [htmp, xxs, yys] = __stairs__ (true, varargin{:});
--- a/scripts/plot/surf.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/surf.m	Fri Aug 09 19:26:55 2013 -0700
@@ -62,7 +62,10 @@
 
   [hax, varargin] = __plt_get_axis_arg__ ("surf", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     
--- a/scripts/plot/surfc.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/surfc.m	Fri Aug 09 19:26:55 2013 -0700
@@ -64,7 +64,10 @@
     print_usage ();
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
     
--- a/scripts/plot/surfl.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/surfl.m	Fri Aug 09 19:26:55 2013 -0700
@@ -136,7 +136,10 @@
     endif
   endif
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   unwind_protect
     hax = newplot (hax);
 
--- a/scripts/plot/surfnorm.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/plot/surfnorm.m	Fri Aug 09 19:26:55 2013 -0700
@@ -114,7 +114,10 @@
   nz = nz ./ len;
 
   if (nargout == 0)
-   oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
    unwind_protect
      hax = newplot (hax);
      
--- a/scripts/time/datetick.m	Thu Aug 08 14:34:12 2013 -0700
+++ b/scripts/time/datetick.m	Fri Aug 09 19:26:55 2013 -0700
@@ -35,7 +35,10 @@
 
   [hax, varargin, nargin] = __plt_get_axis_arg__ ("datetick", varargin{:});
 
-  oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
+  oldfig = [];
+  if (isempty (hax))
+    oldfig = get (0, "currentfigure");
+  endif
   if (isempty (hax))
     hax = gca ();
   endif