cla() ?

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 - 3 | Next >

cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I just noticed there is no cla() function.

Over the weekend I'll add a new trivial function for gca().

I took a quick look at what delete(gca) would do.

octave-3.1.51+:79> figure(1)
octave-3.1.51+:80> axis;
octave-3.1.51+:81> plot(1:10)
octave-3.1.51+:82> delete(gca)
octave-3.1.51+:83> plot(1:10)
error: axes: expecting argument to be axes handle
error: called from:
error:   /sw/share/octave/3.1.51+/m/plot/axes.m at line 54, column 7
error: axes: expecting argument to be axes handle
error: called from:
error:   /sw/share/octave/3.1.51+/m/plot/axes.m at line 54, column 7
error:   /sw/share/octave/3.1.51+/m/plot/plot.m at line 187, column 5
octave-3.1.51+:84> gca
ans = -67.893

If anyone have some background info on this, I'd appreciate some info. If not I'll dig into this rabbit hole as well.

Ben


Re: cla() ?

by dbateman2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ben Abbott wrote:

> I just noticed there is no cla() function.
>
> Over the weekend I'll add a new trivial function for gca().
>
> I took a quick look at what delete(gca) would do.
>
> octave-3.1.51+:79> figure(1)
> octave-3.1.51+:80> axis;
> octave-3.1.51+:81> plot(1:10)
> octave-3.1.51+:82> delete(gca)
> octave-3.1.51+:83> plot(1:10)
> error: axes: expecting argument to be axes handle
> error: called from:
> error:   /sw/share/octave/3.1.51+/m/plot/axes.m at line 54, column 7
> error: axes: expecting argument to be axes handle
> error: called from:
> error:   /sw/share/octave/3.1.51+/m/plot/axes.m at line 54, column 7
> error:   /sw/share/octave/3.1.51+/m/plot/plot.m at line 187, column 5
> octave-3.1.51+:84> gca
> ans = -67.893
>

Congrats, it looks like you've found the bug I've been struggling with
(though not much recently). Check the thread

http://www.nabble.com/base_graphics_backend-to19385836.html

If you do find the reason, then I'll be able to apply my plotyy/colotbar
changes and we can get that little bit closer to a 3.2 releasew :-)

D.

--
David Bateman                                dbateman@...
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)

Parent Message unknown Re: cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 On Friday, October 03, 2008, at 04:26PM, "David Bateman" <dbateman@...> wrote:

>Ben Abbott wrote:
>> I just noticed there is no cla() function.
>>
>> Over the weekend I'll add a new trivial function for gca().
>>
>> I took a quick look at what delete(gca) would do.
>>
>> octave-3.1.51+:79> figure(1)
>> octave-3.1.51+:80> axis;
>> octave-3.1.51+:81> plot(1:10)
>> octave-3.1.51+:82> delete(gca)
>> octave-3.1.51+:83> plot(1:10)
>> error: axes: expecting argument to be axes handle
>> error: called from:
>> error:   /sw/share/octave/3.1.51+/m/plot/axes.m at line 54, column 7
>> error: axes: expecting argument to be axes handle
>> error: called from:
>> error:   /sw/share/octave/3.1.51+/m/plot/axes.m at line 54, column 7
>> error:   /sw/share/octave/3.1.51+/m/plot/plot.m at line 187, column 5
>> octave-3.1.51+:84> gca
>> ans = -67.893
>>
>
>Congrats, it looks like you've found the bug I've been struggling with
>(though not much recently). Check the thread
>
>http://www.nabble.com/base_graphics_backend-to19385836.html
>
>If you do find the reason, then I'll be able to apply my plotyy/colotbar
>changes and we can get that little bit closer to a 3.2 release :-)
>
>D.

This is as far as I have gone.

octave-3.1.51+:96> figure(1)
octave-3.1.51+:97> subplot(211)
octave-3.1.51+:98> subplot(212)
octave-3.1.51+:99> hax = get(gcf,'children')
hax =

  -40.963  -28.300

octave-3.1.51+:100> ishandle(hax)
ans = 0
octave-3.1.51+:101> ishandle(hax(1))
ans =  1
octave-3.1.51+:102> ishandle(hax(2))
ans =  1

The ishandle function should return a result for each member of it's input with the same shape as it's input.

As I am limited to the m-file caste, I hope one of you guys in the upper c++ caste can take this on ;-)

If this really is the same problem as the one you posted the link to, than I expect my conclusion as to what the problem is that I've encountered is quite overly simplified.

Ben



Re: cla() ?

by dbateman2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ben Abbott wrote:

> This is as far as I have gone.
>
> octave-3.1.51+:96> figure(1)
> octave-3.1.51+:97> subplot(211)
> octave-3.1.51+:98> subplot(212)
> octave-3.1.51+:99> hax = get(gcf,'children')
> hax =
>
>   -40.963  -28.300
>
> octave-3.1.51+:100> ishandle(hax)
> ans = 0
> octave-3.1.51+:101> ishandle(hax(1))
> ans =  1
> octave-3.1.51+:102> ishandle(hax(2))
> ans =  1
>
> The ishandle function should return a result for each member of it's input with the same shape as it's input.
>
> As I am limited to the m-file caste, I hope one of you guys in the upper c++ caste can take this on ;-)
>
> If this really is the same problem as the one you posted the link to, than I expect my conclusion as to what the problem is that I've encountered is quite overly simplified.
Ok then its not the same bug but produces the same errors, which is a
pity as I was hoping for help :-( .. In any case the fix for this is
relatively easy, and a changeset is attached.

D.



>
> Ben
>
>
>


--
David Bateman                                dbateman@...
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)

# HG changeset patch
# User David Bateman <dbateman@...>
# Date 1223085861 -3600
# Node ID 65042ade136fe047c224cef1e831681725a08d5f
# Parent  04a45d7107359f26fc7570bac682b006c20936d0
Handle arrays of  handles in the Fishandle function

diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-04  David Bateman  <dbateman@...>
+
+ * graphics.cc (static bool is_handle (const octave_value&)): Delete.
+ (static octave_value is_handle (const octave_value&)): New function.
+
 2008-09-27  David Bateman  <dbateman@...>
 
  * symtab.cc (octave_value symbol_table::find_function
diff --git a/src/graphics.cc b/src/graphics.cc
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -1424,10 +1424,29 @@
   return h.ok ();
 }
 
-static bool
+static octave_value
 is_handle (const octave_value& val)
 {
-  return val.is_real_scalar () && is_handle (val.double_value ());
+  octave_value retval = false;
+
+  if (val.is_real_scalar () && is_handle (val.double_value ()))
+    retval = true;
+  else if (val.is_real_matrix ())
+    {
+      const NDArray handles = val.array_value ();
+
+      if (! error_state)
+ {
+  NDArray result = boolNDArray (handles.dims ());
+
+  for (octave_idx_type i = 0; i < handles.numel (); i++)
+    result.xelem (i) = is_handle (handles (i));
+
+  retval = result;
+ }
+    }
+
+  return retval;
 }
 
 static bool

Re: cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 3, 2008, at 10:06 PM, David Bateman wrote:

> Ben Abbott wrote:
>> This is as far as I have gone.
>> octave-3.1.51+:96> figure(1)
>> octave-3.1.51+:97> subplot(211)
>> octave-3.1.51+:98> subplot(212)
>> octave-3.1.51+:99> hax = get(gcf,'children')
>> hax =
>>  -40.963  -28.300
>> octave-3.1.51+:100> ishandle(hax)
>> ans = 0
>> octave-3.1.51+:101> ishandle(hax(1))
>> ans =  1
>> octave-3.1.51+:102> ishandle(hax(2))
>> ans =  1
>> The ishandle function should return a result for each member of  
>> it's input with the same shape as it's input.
>> As I am limited to the m-file caste, I hope one of you guys in the  
>> upper c++ caste can take this on ;-)
>> If this really is the same problem as the one you posted the link  
>> to, than I expect my conclusion as to what the problem is that I've  
>> encountered is quite overly simplified.
>
> Ok then its not the same bug but produces the same errors, which is  
> a pity as I was hoping for help :-( .. In any case the fix for this  
> is relatively easy, and a changeset is attached.
>
> D.

Thanks.

I've started a build and will offer a changeset for the new function  
cla() tomorrow.

Ben

Re: cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 3, 2008, at 10:40 PM, Ben Abbott wrote:

>
> On Oct 3, 2008, at 10:06 PM, David Bateman wrote:
>
>> Ben Abbott wrote:
>>> This is as far as I have gone.
>>> octave-3.1.51+:96> figure(1)
>>> octave-3.1.51+:97> subplot(211)
>>> octave-3.1.51+:98> subplot(212)
>>> octave-3.1.51+:99> hax = get(gcf,'children')
>>> hax =
>>> -40.963  -28.300
>>> octave-3.1.51+:100> ishandle(hax)
>>> ans = 0
>>> octave-3.1.51+:101> ishandle(hax(1))
>>> ans =  1
>>> octave-3.1.51+:102> ishandle(hax(2))
>>> ans =  1
>>> The ishandle function should return a result for each member of  
>>> it's input with the same shape as it's input.
>>> As I am limited to the m-file caste, I hope one of you guys in the  
>>> upper c++ caste can take this on ;-)
>>> If this really is the same problem as the one you posted the link  
>>> to, than I expect my conclusion as to what the problem is that  
>>> I've encountered is quite overly simplified.
>>
>> Ok then its not the same bug but produces the same errors, which is  
>> a pity as I was hoping for help :-( .. In any case the fix for this  
>> is relatively easy, and a changeset is attached.
>>
>> D.
>
> Thanks.
>
> I've started a build and will offer a changeset for the new function  
> cla() tomorrow.
>
> Ben

The build with jwe's most recent sources failed with your patch  
applied. I don't know if it matters, but he has about 6 more days of  
changesets applied as is indicated by your ChangeLog.

A build without the "ishandle" changeset went fine.

The error which ended the make process is below.

[...]
making vr-idx.texi from vr-idx.txi
gawk -f ./mkcontrib.awk ./contributors.in > contributors.texi-t
makeinfo -I.. -I. -I./.. ./octave.texi
../../run-octave -f -q -H -p . --eval "sparseimages ('gplot', 'eps');"

if [ -f gplot.eps ] ; then gs -dBATCH -dEPSCrop -dNOPAUSE -q -
sDEVICE=pdfwrite -sOutputFile=gplot.pdf gplot.eps ; fi
../../run-octave -f -q -H -p . --eval "sparseimages ('grid', 'eps');"

if [ -f grid.eps ] ; then gs -dBATCH -dEPSCrop -dNOPAUSE -q -
sDEVICE=pdfwrite -sOutputFile=grid.pdf grid.eps ; fi
../../run-octave -f -q -H -p . --eval "sparseimages ('spmatrix',  
'eps');"
error: invalid conversion from string to real N-d array
error: called from:
error:   /sw/src/fink.build/octave3.1.51-3.1.51-3/octave-3.1.51/
scripts/plot/__plt_get_axis_arg__.m at line 38, column 1
error:   /sw/src/fink.build/octave3.1.51-3.1.51-3/octave-3.1.51/
scripts/plot/axis.m at line 125, column 26
error:   /sw/src/fink.build/octave3.1.51-3.1.51-3/octave-3.1.51/doc/
interpreter/sparseimages.m at line 92, column 5
error:   /sw/src/fink.build/octave3.1.51-3.1.51-3/octave-3.1.51/doc/
interpreter/sparseimages.m at line 35, column 2

make[3]: *** [spmatrix.eps] Error 1
make[2]: *** [interpreter] Error 2
make[1]: *** [doc] Error 2
make: *** [all] Error 2

Ben



Re: cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 4, 2008, at 11:06 AM, Ben Abbott wrote:

>
> On Oct 3, 2008, at 10:40 PM, Ben Abbott wrote:
>
>>
>> On Oct 3, 2008, at 10:06 PM, David Bateman wrote:
>>
>>> Ben Abbott wrote:
>>>> This is as far as I have gone.
>>>> octave-3.1.51+:96> figure(1)
>>>> octave-3.1.51+:97> subplot(211)
>>>> octave-3.1.51+:98> subplot(212)
>>>> octave-3.1.51+:99> hax = get(gcf,'children')
>>>> hax =
>>>> -40.963  -28.300
>>>> octave-3.1.51+:100> ishandle(hax)
>>>> ans = 0
>>>> octave-3.1.51+:101> ishandle(hax(1))
>>>> ans =  1
>>>> octave-3.1.51+:102> ishandle(hax(2))
>>>> ans =  1
>>>> The ishandle function should return a result for each member of  
>>>> it's input with the same shape as it's input.
>>>> As I am limited to the m-file caste, I hope one of you guys in  
>>>> the upper c++ caste can take this on ;-)
>>>> If this really is the same problem as the one you posted the link  
>>>> to, than I expect my conclusion as to what the problem is that  
>>>> I've encountered is quite overly simplified.
>>>
>>> Ok then its not the same bug but produces the same errors, which  
>>> is a pity as I was hoping for help :-( .. In any case the fix for  
>>> this is relatively easy, and a changeset is attached.
>>>
>>> D.
>>
>> Thanks.
>>
>> I've started a build and will offer a changeset for the new  
>> function cla() tomorrow.
>>
>> Ben
>
> The build with jwe's most recent sources failed with your patch  
> applied. I don't know if it matters, but he has about 6 more days of  
> changesets applied as is indicated by your ChangeLog.
>
> A build without the "ishandle" changeset went fine.
>
> The error which ended the make process is below.
>
> [...]
> making vr-idx.texi from vr-idx.txi
> gawk -f ./mkcontrib.awk ./contributors.in > contributors.texi-t
> makeinfo -I.. -I. -I./.. ./octave.texi
> ../../run-octave -f -q -H -p . --eval "sparseimages ('gplot', 'eps');"
>
> if [ -f gplot.eps ] ; then gs -dBATCH -dEPSCrop -dNOPAUSE -q -
> sDEVICE=pdfwrite -sOutputFile=gplot.pdf gplot.eps ; fi
> ../../run-octave -f -q -H -p . --eval "sparseimages ('grid', 'eps');"
>
> if [ -f grid.eps ] ; then gs -dBATCH -dEPSCrop -dNOPAUSE -q -
> sDEVICE=pdfwrite -sOutputFile=grid.pdf grid.eps ; fi
> ../../run-octave -f -q -H -p . --eval "sparseimages ('spmatrix',  
> 'eps');"
> error: invalid conversion from string to real N-d array
> error: called from:
> error:   /sw/src/fink.build/octave3.1.51-3.1.51-3/octave-3.1.51/
> scripts/plot/__plt_get_axis_arg__.m at line 38, column 1
> error:   /sw/src/fink.build/octave3.1.51-3.1.51-3/octave-3.1.51/
> scripts/plot/axis.m at line 125, column 26
> error:   /sw/src/fink.build/octave3.1.51-3.1.51-3/octave-3.1.51/doc/
> interpreter/sparseimages.m at line 92, column 5
> error:   /sw/src/fink.build/octave3.1.51-3.1.51-3/octave-3.1.51/doc/
> interpreter/sparseimages.m at line 35, column 2
>
> make[3]: *** [spmatrix.eps] Error 1
> make[2]: *** [interpreter] Error 2
> make[1]: *** [doc] Error 2
> make: *** [all] Error 2
>
> Ben

I found the problem.

octave:4> ishandle('ij')
error: invalid conversion from string to real N-d array

This occurs for axis('ij')

Ben



Re: cla() ?

by dbateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ben Abbott wrote:
octave:4> ishandle('ij')
error: invalid conversion from string to real N-d array
Ok, I see the issue but can't fix it till tomorrow.

Cheers
David

Re: cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 5, 2008, at 2:57 PM, dbateman <dbateman@...> wrote:

>
> Ben Abbott wrote:
>>
>> octave:4> ishandle('ij')
>> error: invalid conversion from string to real N-d array
>>
>
> Ok, I see the issue but can't fix it till tomorrow.
>
> Cheers
> David
> -- View this message in context: http://www.nabble.com/cla%28%29---tp19802541p19827911.html
> Sent from the Octave - Maintainers mailing list archive at Nabble.com.
>

There's a few functions, that rely upon the current ishandle()  
behavior, which will need to be changed as well.

Once ishandle works correctly I'll submit change sets for those I've  
found.

So far my list includes __plt_get_axis_arg__.m, axes.m, hold.m, and  
orient.m.

Ben




[Changeset]: Re: cla() ?

by David Bateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ben Abbott wrote:
>
> There's a few functions, that rely upon the current ishandle()
> behavior, which will need to be changed as well.
>
> Once ishandle works correctly I'll submit change sets for those I've
> found.
>
> So far my list includes __plt_get_axis_arg__.m, axes.m, hold.m, and
> orient.m.

Ok, I suppose you mean that ishandle('ij') should return "false(1,2)",
and that the code needs to be adapted to handle that. If you want to
make these changes then I'll let you do it.. I  suggest the updated
changeset attached to get a behavior that special cases strings that are
passed to ishandle.

D.

--
David Bateman                                David.Bateman@...
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

The information contained in this communication has been classified as:

[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary


# HG changeset patch
# User David Bateman <dbateman@...>
# Date 1223283901 -3600
# Node ID 8eef4d0469250e678c877c8a2259f6c8b0d781f9
# Parent  04a45d7107359f26fc7570bac682b006c20936d0
Handle arrays of  handles in the Fishandle function

diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-04  David Bateman  <dbateman@...>
+
+ * graphics.cc (static bool is_handle (const octave_value&)): Delete.
+ (static octave_value is_handle (const octave_value&)): New function.
+
 2008-09-27  David Bateman  <dbateman@...>
 
  * symtab.cc (octave_value symbol_table::find_function
diff --git a/src/graphics.cc b/src/graphics.cc
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -1424,10 +1424,34 @@
   return h.ok ();
 }
 
-static bool
+static octave_value
 is_handle (const octave_value& val)
 {
-  return val.is_real_scalar () && is_handle (val.double_value ());
+  octave_value retval = false;
+
+  if (val.is_real_scalar () && is_handle (val.double_value ()))
+    retval = true;
+  else if (val.is_real_matrix ())
+    {
+      if (val.is_string ())
+ retval = boolNDArray (val.dims (), false);
+      else
+ {
+  const NDArray handles = val.array_value ();
+
+  if (! error_state)
+    {
+      boolNDArray result (handles.dims ());
+
+      for (octave_idx_type i = 0; i < handles.numel (); i++)
+ result.xelem (i) = is_handle (handles (i));
+
+      retval = result;
+    }
+ }
+    }
+
+  return retval;
 }
 
 static bool

[Changeset]: Re: cla() ?

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  6-Oct-2008, David Bateman wrote:

| Ben Abbott wrote:
| >
| > There's a few functions, that rely upon the current ishandle()
| > behavior, which will need to be changed as well.
| >
| > Once ishandle works correctly I'll submit change sets for those I've
| > found.
| >
| > So far my list includes __plt_get_axis_arg__.m, axes.m, hold.m, and
| > orient.m.
|
| Ok, I suppose you mean that ishandle('ij') should return "false(1,2)",
| and that the code needs to be adapted to handle that. If you want to
| make these changes then I'll let you do it.. I  suggest the updated
| changeset attached to get a behavior that special cases strings that are
| passed to ishandle.

I applied it.

Thanks,

jwe

Re: [Changeset]: Re: cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 6, 2008, at 5:32 AM, David Bateman wrote:

> Ben Abbott wrote:
>>
>> There's a few functions, that rely upon the current ishandle()  
>> behavior, which will need to be changed as well.
>>
>> Once ishandle works correctly I'll submit change sets for those  
>> I've found.
>>
>> So far my list includes __plt_get_axis_arg__.m, axes.m, hold.m, and  
>> orient.m.
>
> Ok, I suppose you mean that ishandle('ij') should return  
> "false(1,2)", and that the code needs to be adapted to handle that.  
> If you want to make these changes then I'll let you do it.. I  
> suggest the updated changeset attached to get a behavior that  
> special cases strings that are passed to ishandle.
Everything compiled and make check had no problem.

Given that I don't see any failures, does it make sense to also apply  
a changeset such as the one I've attached?

As my c++ skill is wanting, please review this proposal before  
committing.

Ben


# HG changeset patch
# User Ben Abbott <bpabbott@...>
# Date 1223314661 14400
# Node ID c83510fbcbe1e01fd1332a8a0af42a99239c26b9
# Parent  277218396978303b29d49502590d507afd47dc9f
Remove reliance on ishandle(vec) == false.

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-24 Ben Abbott <bpabbott@...>
+
+ * plot/orient.m: Fig handle must be scalar.
+ * plot/hold.m: Axis handle must be scalar.
+ * plot/axes.m: Axis handle must be scalar.
+ * plot/__plt_get_axis_arg__.m: Handle must be scalar.
+
 2008-10-02  John W. Eaton  <jwe@...>
 
  * pkg/pkg.m (configure_make): Handle filenames with spaces.
diff --git a/scripts/plot/__plt_get_axis_arg__.m b/scripts/plot/__plt_get_axis_arg__.m
--- a/scripts/plot/__plt_get_axis_arg__.m
+++ b/scripts/plot/__plt_get_axis_arg__.m
@@ -32,8 +32,8 @@
 
   ## Figure handles are integers, but object handles are non integer,
   ## therefore ignore integer scalars.
-  if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})
-      && floor(varargin{1}) != varargin{1})
+  if (nargin > 1 && length (varargin) > 0 && numel(varargin{1}) == 1 && ishandle (varargin{1}(1))
+      && floor(varargin{1}(1)) != varargin{1}(1))
     tmp = varargin{1};
     obj = get (tmp);
     if (strcmp (obj.type, "axes") || strcmp (obj.type, "hggroup"))
diff --git a/scripts/plot/axes.m b/scripts/plot/axes.m
--- a/scripts/plot/axes.m
+++ b/scripts/plot/axes.m
@@ -43,12 +43,12 @@
     ## arg is axes handle, make it the current axes for the current
     ## figure.
     tmp = varargin{1};
-    if (ishandle (tmp) && strcmp (get (tmp, "type"), "axes"))
+    if (length(tmp) == 1 && ishandle (tmp) && strcmp (get (tmp, "type"), "axes"))
       parent = ancestor (tmp, "figure");
       set (0, "currentfigure", parent);
       set (parent, "currentaxes", tmp);
     else
-      error ("axes: expecting argument to be axes handle");
+      error ("axes: expecting argument to be a scalar axes handle");
     endif
   endif
 
diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m
--- a/scripts/plot/hold.m
+++ b/scripts/plot/hold.m
@@ -44,8 +44,10 @@
 
 function hold (varargin)
 
-  if (nargin > 0 && ishandle (varargin{1}))
+  if (nargin > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)))
     [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:});
+  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}(1)))
+    error ('Invalid input or option')
   else
     h = gcf ();
     nargs = numel (varargin);
diff --git a/scripts/plot/orient.m b/scripts/plot/orient.m
--- a/scripts/plot/orient.m
+++ b/scripts/plot/orient.m
@@ -32,7 +32,7 @@
 
   nargs = nargin;
 
-  if (nargs > 0 && ishandle (varargin{1}))
+  if (nargs > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}))
     cf = varargin{1};
     varargin(1) = [];
     nargs--;





Re: [Changeset]: Re: cla() ?

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  6-Oct-2008, Ben Abbott wrote:

| Everything compiled and make check had no problem.
|
| Given that I don't see any failures, does it make sense to also apply  
| a changeset such as the one I've attached?
|
| As my c++ skill is wanting, please review this proposal before  
| committing.

I don't see any C++ in this patch.

| diff --git a/scripts/plot/__plt_get_axis_arg__.m b/scripts/plot/__plt_get_axis_arg__.m
| --- a/scripts/plot/__plt_get_axis_arg__.m
| +++ b/scripts/plot/__plt_get_axis_arg__.m
| @@ -32,8 +32,8 @@
|  
|    ## Figure handles are integers, but object handles are non integer,
|    ## therefore ignore integer scalars.
| -  if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})
| -      && floor(varargin{1}) != varargin{1})
| +  if (nargin > 1 && length (varargin) > 0 && numel(varargin{1}) == 1 && ishandle (varargin{1}(1))
| +      && floor(varargin{1}(1)) != varargin{1}(1))

I think a test like

  floor(varargin{1}(1)) != varargin{1}(1))

depends too much on the current implementation of figure handles.
Maybe it would be better to use "! isfigure (varargin{1}(1))" instead?

| diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m
| --- a/scripts/plot/hold.m
| +++ b/scripts/plot/hold.m
| @@ -44,8 +44,10 @@
|  
|  function hold (varargin)
|  
| -  if (nargin > 0 && ishandle (varargin{1}))
| +  if (nargin > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)))
|      [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:});
| +  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}(1)))
| +    error ('Invalid input or option')

Unless you can provide a better diagnostic, I think this should just
be a call to print_usage.

jwe

Re: [Changeset]: Re: cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday, October 06, 2008, at 02:02PM, "John W. Eaton" <jwe@...> wrote:

>On  6-Oct-2008, Ben Abbott wrote:
>
>| Everything compiled and make check had no problem.
>|
>| Given that I don't see any failures, does it make sense to also apply  
>| a changeset such as the one I've attached?
>|
>| As my c++ skill is wanting, please review this proposal before  
>| committing.
>
>I don't see any C++ in this patch.

My concern is as to whether or not those changes are consistent with David's changeset.

Ben

Re: [Changeset]: Re: cla() ?

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Monday, October 06, 2008, at 02:02PM, "John W. Eaton" <jwe@...> wrote:

>On  6-Oct-2008, Ben Abbott wrote:
>
>| Everything compiled and make check had no problem.
>|
>| Given that I don't see any failures, does it make sense to also apply  
>| a changeset such as the one I've attached?
>|
>| As my c++ skill is wanting, please review this proposal before  
>| committing.
>
>I don't see any C++ in this patch.
>
>| diff --git a/scripts/plot/__plt_get_axis_arg__.m b/scripts/plot/__plt_get_axis_arg__.m
>| --- a/scripts/plot/__plt_get_axis_arg__.m
>| +++ b/scripts/plot/__plt_get_axis_arg__.m
>| @@ -32,8 +32,8 @@
>|  
>|    ## Figure handles are integers, but object handles are non integer,
>|    ## therefore ignore integer scalars.
>| -  if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})
>| -      && floor(varargin{1}) != varargin{1})
>| +  if (nargin > 1 && length (varargin) > 0 && numel(varargin{1}) == 1 && ishandle (varargin{1}(1))
>| +      && floor(varargin{1}(1)) != varargin{1}(1))
>
>I think a test like
>
>  floor(varargin{1}(1)) != varargin{1}(1))
>
>depends too much on the current implementation of figure handles.
>Maybe it would be better to use "! isfigure (varargin{1}(1))" instead?
>
>| diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m
>| --- a/scripts/plot/hold.m
>| +++ b/scripts/plot/hold.m
>| @@ -44,8 +44,10 @@
>|  
>|  function hold (varargin)
>|  
>| -  if (nargin > 0 && ishandle (varargin{1}))
>| +  if (nargin > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)))
>|      [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:});
>| +  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}(1)))
>| +    error ('Invalid input or option')
>
>Unless you can provide a better diagnostic, I think this should just
>be a call to print_usage.
>
>jwe
ok. I've made those changes ... "make check" went fine.

Ben


# HG changeset patch
# User Ben Abbott <bpabbott@...>
# Date 1223319773 14400
# Node ID bc0e9f539265ce5c9fd0d782305a751b7d1bcc35
# Parent  277218396978303b29d49502590d507afd47dc9f
Remove reliance on ishandle(vec) == false.

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-24 Ben Abbott <bpabbott@...>
+
+ * plot/orient.m: Fig handle must be scalar.
+ * plot/hold.m: Axis handle must be scalar.
+ * plot/axes.m: Axis handle must be scalar.
+ * plot/__plt_get_axis_arg__.m: Handle must be scalar.
+
 2008-10-02  John W. Eaton  <jwe@...>
 
  * pkg/pkg.m (configure_make): Handle filenames with spaces.
diff --git a/scripts/plot/__plt_get_axis_arg__.m b/scripts/plot/__plt_get_axis_arg__.m
--- a/scripts/plot/__plt_get_axis_arg__.m
+++ b/scripts/plot/__plt_get_axis_arg__.m
@@ -32,8 +32,8 @@
 
   ## Figure handles are integers, but object handles are non integer,
   ## therefore ignore integer scalars.
-  if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})
-      && floor(varargin{1}) != varargin{1})
+  if (nargin > 1 && length (varargin) > 0 && numel(varargin{1}) == 1 && ishandle (varargin{1}(1))
+      && ! isfigure (varargin{1}(1)))
     tmp = varargin{1};
     obj = get (tmp);
     if (strcmp (obj.type, "axes") || strcmp (obj.type, "hggroup"))
diff --git a/scripts/plot/axes.m b/scripts/plot/axes.m
--- a/scripts/plot/axes.m
+++ b/scripts/plot/axes.m
@@ -43,12 +43,12 @@
     ## arg is axes handle, make it the current axes for the current
     ## figure.
     tmp = varargin{1};
-    if (ishandle (tmp) && strcmp (get (tmp, "type"), "axes"))
+    if (length(tmp) == 1 && ishandle (tmp) && strcmp (get (tmp, "type"), "axes"))
       parent = ancestor (tmp, "figure");
       set (0, "currentfigure", parent);
       set (parent, "currentaxes", tmp);
     else
-      error ("axes: expecting argument to be axes handle");
+      error ("axes: expecting argument to be a scalar axes handle");
     endif
   endif
 
diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m
--- a/scripts/plot/hold.m
+++ b/scripts/plot/hold.m
@@ -44,8 +44,10 @@
 
 function hold (varargin)
 
-  if (nargin > 0 && ishandle (varargin{1}))
+  if (nargin > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)))
     [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:});
+  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}(1)))
+    print_usage ();
   else
     h = gcf ();
     nargs = numel (varargin);
diff --git a/scripts/plot/orient.m b/scripts/plot/orient.m
--- a/scripts/plot/orient.m
+++ b/scripts/plot/orient.m
@@ -32,7 +32,7 @@
 
   nargs = nargin;
 
-  if (nargs > 0 && ishandle (varargin{1}))
+  if (nargs > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}))
     cf = varargin{1};
     varargin(1) = [];
     nargs--;

[Changeset]: delete (vector)

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

changeset to permit "delete()" to act on a vector of handles.

Ben


# HG changeset patch
# User Ben Abbott <bpabbott@...>
# Date 1223335199 14400
# Node ID e0c2d03d57c62137ba33a945863c6c029ecbef82
# Parent  23ff439ea0dd90e14f8dd3c9f187a45d4c52db4b
delete.m: Permit a vector of handles to be deleted.

diff -r 23ff439ea0dd -r e0c2d03d57c6 scripts/ChangeLog
--- a/scripts/ChangeLog Mon Oct 06 16:16:04 2008 -0400
+++ b/scripts/ChangeLog Mon Oct 06 19:19:59 2008 -0400
@@ -1,3 +1,7 @@
+2008-10-06  Ben Abbott <bpabbott@...>
+
+ * miscellaneous/delete.m: Permit a vector of handles to be deleted..
+
 2008-10-02  John W. Eaton  <jwe@...>
 
  * pkg/pkg.m (configure_make): Handle filenames with spaces.
diff -r 23ff439ea0dd -r e0c2d03d57c6 scripts/miscellaneous/delete.m
--- a/scripts/miscellaneous/delete.m Mon Oct 06 16:16:04 2008 -0400
+++ b/scripts/miscellaneous/delete.m Mon Oct 06 19:19:59 2008 -0400
@@ -19,7 +19,7 @@
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} delete (@var{file})
 ## @deftypefnx {Function File} {} delete (@var{h})
-## Delete the named file or figure handle.
+## Delete the named file or graphics handle.
 ## @end deftypefn
 
 ## PKG_ADD: mark_as_command delete
@@ -31,9 +31,11 @@
   if (nargin == 1)
     if (ischar (arg))
       unlink (arg);
-    elseif (ishandle (arg))
+    elseif (all (ishandle (arg)))
       ## Delete a graphics object.
-      __go_delete__ (arg);
+      for n = 1:numel(arg)
+         __go_delete__ (arg(n));
+      endfor
     else
       error ("delete: expecting argument to be a filename or graphics handle");
     endif



[Changeset]: delete (vector)

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  6-Oct-2008, Ben Abbott wrote:

| changeset to permit "delete()" to act on a vector of handles.

I aplpied it.

Thanks,

jwe

Re: [Changeset]: Re: cla() ?

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  6-Oct-2008, Ben Abbott wrote:

|
| On Monday, October 06, 2008, at 02:02PM, "John W. Eaton" <jwe@...> wrote:
| >On  6-Oct-2008, Ben Abbott wrote:
| >
| >| Everything compiled and make check had no problem.
| >|
| >| Given that I don't see any failures, does it make sense to also apply  
| >| a changeset such as the one I've attached?
| >|
| >| As my c++ skill is wanting, please review this proposal before  
| >| committing.
| >
| >I don't see any C++ in this patch.
| >
| >| diff --git a/scripts/plot/__plt_get_axis_arg__.m b/scripts/plot/__plt_get_axis_arg__.m
| >| --- a/scripts/plot/__plt_get_axis_arg__.m
| >| +++ b/scripts/plot/__plt_get_axis_arg__.m
| >| @@ -32,8 +32,8 @@
| >|  
| >|    ## Figure handles are integers, but object handles are non integer,
| >|    ## therefore ignore integer scalars.
| >| -  if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})
| >| -      && floor(varargin{1}) != varargin{1})
| >| +  if (nargin > 1 && length (varargin) > 0 && numel(varargin{1}) == 1 && ishandle (varargin{1}(1))
| >| +      && floor(varargin{1}(1)) != varargin{1}(1))
| >
| >I think a test like
| >
| >  floor(varargin{1}(1)) != varargin{1}(1))
| >
| >depends too much on the current implementation of figure handles.
| >Maybe it would be better to use "! isfigure (varargin{1}(1))" instead?
| >
| >| diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m
| >| --- a/scripts/plot/hold.m
| >| +++ b/scripts/plot/hold.m
| >| @@ -44,8 +44,10 @@
| >|  
| >|  function hold (varargin)
| >|  
| >| -  if (nargin > 0 && ishandle (varargin{1}))
| >| +  if (nargin > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)))
| >|      [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:});
| >| +  elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1}(1)))
| >| +    error ('Invalid input or option')
| >
| >Unless you can provide a better diagnostic, I think this should just
| >be a call to print_usage.
| >
| >jwe
|
| ok. I've made those changes ... "make check" went fine.

I applied the changeset.

Thanks,

jwe

Re: [Changeset]: delete (vector)

by Michael Goffioul-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Wouldn't it be faster to support vector of handles within
__go_delete__ instead?

Michael.


On Tue, Oct 7, 2008 at 2:36 AM, John W. Eaton <jwe@...> wrote:

> On  6-Oct-2008, Ben Abbott wrote:
>
> | changeset to permit "delete()" to act on a vector of handles.
>
> I aplpied it.
>
> Thanks,
>
> jwe
>

Re: [Changeset]: Re: cla() ?

by Michael Goffioul-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Oct 6, 2008 at 8:02 PM, John W. Eaton <jwe@...> wrote:

> | diff --git a/scripts/plot/__plt_get_axis_arg__.m b/scripts/plot/__plt_get_axis_arg__.m
> | --- a/scripts/plot/__plt_get_axis_arg__.m
> | +++ b/scripts/plot/__plt_get_axis_arg__.m
> | @@ -32,8 +32,8 @@
> |
> |    ## Figure handles are integers, but object handles are non integer,
> |    ## therefore ignore integer scalars.
> | -  if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})
> | -      && floor(varargin{1}) != varargin{1})
> | +  if (nargin > 1 && length (varargin) > 0 && numel(varargin{1}) == 1 && ishandle (varargin{1}(1))
> | +      && floor(varargin{1}(1)) != varargin{1}(1))
>
> I think a test like
>
>  floor(varargin{1}(1)) != varargin{1}(1))
>
> depends too much on the current implementation of figure handles.
> Maybe it would be better to use "! isfigure (varargin{1}(1))" instead?

Testing the handle value is definitely NOT the way to go to check
for a figure, given the fact that when IntegerHandle is off, the figure
handle won't be integer anymore. The safest way is simply to check
the Type property of the graphics object (as isfigure does).

Michael.
< Prev | 1 - 2 - 3 | Next >