changeset 18507:dca6ecfd622c gui-release

findobj.m: let leading negation work (bug #41588). * findobj.m: keep track of extranegation.
author Sergey Plotnikov <seryozha.plotnikov@gmail.com>
date Tue, 18 Feb 2014 18:21:55 +0100
parents fb96b7f55242
children 1075f2543574
files scripts/plot/util/findobj.m
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/findobj.m	Fri Feb 21 11:35:36 2014 -0500
+++ b/scripts/plot/util/findobj.m	Tue Feb 18 18:21:55 2014 +0100
@@ -119,6 +119,7 @@
   regularexpression = [];
   property          = [];
   logicaloperator   = {};
+  extranegation     = [];
   pname             = {};
   pvalue            = {};
   np = 1;
@@ -128,6 +129,9 @@
   while (na <= numel (args))
     regularexpression(np) = 0;
     property(np) = 0;
+    if (numel (extranegation) < np)
+      extranegation(np) = false;
+    endif
     logicaloperator{np} = "and";
     if (ischar (args{na}))
       if (strcmpi (args{na}, "-regexp"))
@@ -177,10 +181,8 @@
           error ("findobj: inconsistent number of arguments");
         endif
       else
-        ## This is sloppy ... but works like Matlab.
         if (strcmpi (args{na}, "-not"))
-          h = [];
-          return;
+          extranegation(np) = true;
         endif
         na = na + 1;
       endif
@@ -241,6 +243,9 @@
         else
           match(nh,np) = false;
         endif
+        if (extranegation(np))
+          match(nh,np) = ! match(nh,np);
+        endif
       endfor
     endfor