User`s guide

Table Of Contents
Placing ActiveX Controls in a Figure Window
4-10
Placing ActiveX Controls in a Figure Window
In this example, a simple model displays the simulation time on an ActiveX
Control block located in a figure window. You can open a completed copy of the
model by typing
dng_offblock in MATLAB, or you can follow the instructions
below for building it yourself. The model looks like this.
1 Create and execute an M-file called dng_gaugewindow that consists of these
statements.
f = figure;
h = actxcontrol('mwagauge.agaugectrl.1', [100 100 100 100], f);
This M-file creates a figure window containing a Generic Angular Gauge,
whose program ID is
mwagauge.agaugectrl.1. The M-file also specifies the
position of the ActiveX control in the figure window. For more information
about
actxcontrol, see its reference documentation.
2 Create an M-file called dng_off_block that consists of these statements.
function hactx = dng_off_block
hactx = evalin('base', 'h');
3 Open the ActiveX Control block to modify its parameters. First, uncheck the
In-block control check box. When you uncheck the In-block control check
box, the number of fields on the dialog box changes.
4 In the Connections field, select input to delete the outport on the ActiveX
Control block.
5 In the Input property field, enter NeedleValue. When a signal is received
at the ActiveX Control block’s inport, this property of the ActiveX Control
block referenced by the ActiveX Control block (the Generic Angular Gauge)
is set with the signal value.
6 In the Handle location field, enter dng_off_block, an M-file containing a
function that returns the handle of the ActiveX Control block that is to be