Dials & Gauges Blockset | ![]() ![]() |
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 completed model looks like this.
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.
dng_off_block
function returns the handle of the ActiveX Control block that is to be connected to the ActiveX Control block.
input
to delete the outport on the ActiveX Control block.
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.
dng_off_block
. With the fields filled in, the Block Parameters dialog box looks like this.
dng_off_block
M-file, which returns the handle of the ActiveX Control block in the figure window. The figure window looks like this (resized).
Note
If you accidentally close the figure window before you are finished exploring the model, you can recreate it by executing dng_gaugewindow .
|
Saving and Reopening the Model
If you want to use this model in a different MATLAB session, then you must preserve both the model and the MATLAB commands that create the figure window and gauge. Here is an easy way to do this:
mymodel
, then use these commands in MATLAB to preserve the commands that create the figure window and gauge.
Now, whenever you open mymodel
, MATLAB automatically creates the figure that contains the gauge.
![]() | Associating Top-Level Blocks with the Subsystem | Block Reference | ![]() |