[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cla() ?
From: |
David Bateman |
Subject: |
Re: cla() ? |
Date: |
Sat, 04 Oct 2008 03:06:15 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.16 (X11/20080724) |
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 address@hidden
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 <address@hidden>
# 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 <address@hidden>
+
+ * 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 <address@hidden>
* 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
- cla() ?, Ben Abbott, 2008/10/03
- Re: cla() ?, Ben Abbott, 2008/10/03
- Re: cla() ?,
David Bateman <=
- Re: cla() ?, Ben Abbott, 2008/10/03
- Re: cla() ?, Ben Abbott, 2008/10/04
- Re: cla() ?, Ben Abbott, 2008/10/04
- Re: cla() ?, dbateman, 2008/10/05
- Re: cla() ?, Ben Abbott, 2008/10/05
- [Changeset]: Re: cla() ?, David Bateman, 2008/10/06
- [Changeset]: Re: cla() ?, John W. Eaton, 2008/10/06
- [Changeset]: delete (vector), Ben Abbott, 2008/10/06
- [Changeset]: delete (vector), John W. Eaton, 2008/10/06
- Re: [Changeset]: delete (vector), Michael Goffioul, 2008/10/07