[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mexGet and mexSet
From: |
David Bateman |
Subject: |
mexGet and mexSet |
Date: |
Fri, 27 Apr 2007 12:26:58 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
As we now have graphic handles, we should implement the mexGet and
mexSet functions. However, there is no functionality exported from
graphics.cc except through DEFUN_DLD functions. The attached patch
exports a simple means of getting/setting a property from graphics.cc,
includes a new declaration of these functions in graphics.h, uses these
functions to write mexGet and mexSet, and finally includes a piece of
test code. After patching and rebuilding Octave, the example code can
be used as follows
mkoctfile --mex myprop.c
h = plot(1:10,1:10)
get (h, "Color")
myprop(h, "Color")
myprop(h, "Color", [1, 0, 0])
myprop(h, "Color")
drawnow
Which returns
octave:1> mkoctfile --mex myprop.c
octave:2> h = plot(1:10,1:10)
h = -2
octave:3> get (h, "Color")
ans =
0 0 1
octave:4> myprop(h, "Color")
ans =
0 0 1
octave:5> myprop(h, "Color", [1, 0, 0])
ans =
0 0 1
octave:6> myprop(h, "Color")
ans =
1 0 0
octave:7> drawnow
and demonstrates that the line color has been changed..
--
David Bateman address@hidden
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
- mexGet and mexSet,
David Bateman <=