Dials & Gauges Blockset    

Accessing an ActiveX Control Block in a Different Model Window
This sample model modifies the bounce demo by displaying the position and velocity signals on ActiveX Control blocks contained in another model window. Modify the model by adding two ActiveX Control blocks before the Velocity Scope and the Bouncing Ball Display Scope. The modified model looks like this.

Create a new model and copy two ActiveX gauges into it.

To connect the ActiveX Control blocks to the controls, open the ActiveX Control blocks and modify the Block Parameters dialog box:

  1. Uncheck the In-block control check box because the signal is being communicated between ActiveX Control blocks in one window and ActiveX Control blocks in another window. When you uncheck the In-block control check box, the number of fields on the dialog box changes.
  2. In the Input property field, specify the NeedleValue property for the position display and PointerValue for the velocity. This property controls the current value of these ActiveX gauges. Doing this passes the value of the input signal to this property.
  3. In the Output property field, specify the same property. Doing this passes the value of this property to the scopes. The library copy of the Generic Linear Gauge has a minimum value of 0 and a maximum value of 100. For more information about changing ActiveX Control block properties, see Modifying ActiveX Control Properties.
  4. Specify the path of each gauge in the Handle location field. In this case, the new model is named ax_example_bounce_1.
The dialog boxes should now look like this.

Accessing an ActiveX Control Block in a Figure Window
In this example, a simple model displays the simulation time on an ActiveX Control block located in a figure window. The model looks like this.

  1. Create a figure window to hold the ActiveX Control block.
  2. Create the ActiveX Control block that is to appear in the figure window, a Generic Angular Gauge, whose program ID is mwagauge.agaugectrl.1. The statement also specifies the position of the ActiveX Control block in the figure window.

    See the reference documentation for actxcontrol.

  1. Create an M-file called off_block that consists of these statements.
  2. Open the ActiveX Control block to modify its parameters. First, uncheck the In-block control check box. The dialog box now looks like this.

  3. In the Connections field, select input to delete the outport on the ActiveX Control block.
  4. 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.
  5. In the Handle location field, enter off_block, an M-file containing a function that returns the handle of the ActiveX Control block that is to be connected to the ActiveX Control block (the code appears below). With the fields filled in, the Block Parameters dialog box looks like this.

  6. Click OK. MATLAB executes the off_block M-file, which returns the handle of the ActiveX Control block in the figure window. The figure window looks like this (resized).

  7. Run the simulation. Notice that the clock time is passed to the Generic Angular Gauge.

 Summary of Dialog Box Fields and Check Boxes The Strip Chart Control Block