From 2409f4ff7a4ceaa1134165e8bd62cae9ec0a0391 Mon Sep 17 00:00:00 2001
From: marwan <>
Date: Tue, 13 Sep 2005 12:07:34 +0000
Subject: [PATCH] small speed up by using simpler commands

---
 waitbar.m | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/waitbar.m b/waitbar.m
index b2d551b..18dd470 100755
--- a/waitbar.m
+++ b/waitbar.m
@@ -42,7 +42,7 @@ function fout = waitbar(x,whichbar, varargin)
 %   Vlad Kolesnikov  06-7-99
 %   Copyright 1984-2000 The MathWorks, Inc.
 %   $Revision$  $Date$
-%   Modified: Norbert Marwan, 2002-12-11, 2004-07-28, 2004-10-25
+%   Modified: Norbert Marwan, 2002-12-11, 2004-07-28, 2004-10-25, 2005-09-13
 
 
 if nargin>=2
@@ -75,7 +75,7 @@ switch type
  case 1,  % waitbar(x)    update
   p = findobj(f,'Type','patch');
   pr = findobj(f,'Type','text'); pr=pr(1);
-  if isempty(f) | isempty(p) | isempty(pr)
+  if isempty(f) || isempty(p) || isempty(pr)
       error('Couldn''t find waitbar handles.'); 
   end
 
@@ -89,7 +89,7 @@ switch type
   end
   
   timeRemain = [];
-  if (secRemain > lastUpdate.showTime | lastUpdate.flag) & lastUpdate.showTime >= 0
+  if (secRemain > lastUpdate.showTime || lastUpdate.flag) && lastUpdate.showTime >= 0
       tx = datestr(datenum(0, 0, 0, 0, 0, secRemain),13);
       if secRemain > 86400
         tx = [datestr(datenum(0, 0, 0, 0, 0, secRemain),7),'d:',datestr(datenum(0, 0, 0, 0, 0, secRemain),13)];
@@ -176,7 +176,7 @@ switch type
       cancelBtnCreated = 0;
       for ii = 1:length( propList )
           try
-              if strcmp(lower(propList{ii}), 'createcancelbtn' ) & ~cancelBtnCreated
+              if strcmpi(propList{ii}, 'createcancelbtn' ) && ~cancelBtnCreated
                   cancelBtnHeight = 23 * pointsPerPixel;
                   cancelBtnWidth = 60 * pointsPerPixel;
                   newPos = pos;
@@ -243,9 +243,9 @@ switch type
   if titleHeight>pos(4)
       pos(4)=titleHeight;
       pos(2)=screenSize(4)/2-pos(4)/2;
-      figPosDirty=logical(1);
+      figPosDirty=true;
   else
-      figPosDirty=logical(0);
+      figPosDirty=false;
   end
   
   if tExtent(3)>pos(3)*1.10;
@@ -255,7 +255,7 @@ switch type
       axPos([1,3])=axNorm([1,3])*pos(3);
       set(h,'Position',axPos);
       
-      figPosDirty=logical(1);
+      figPosDirty=true;
   end
   
   if figPosDirty
-- 
GitLab