| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → xPC Target |
| Contents | Index |
| Learn more about xPC Target |
| On this page… |
|---|
Simulink External Mode Interface Simulink with xPC Target Scope Blocks Target PC Command-Line Interface |
The xPC Target environment has a modifiable interface to the target PC. You can use this interface from MATLAB or Simulink, and you can use other development environments to create stand-alone client applications independent of MATLAB. Because of this open environment, there are several ways to interact with your target application from the host and target PCs.
Note Some blocks (see Blocks Whose Outputs Depend on Inherited Sample Time in the Simulink User's Guide) cannot properly handle sample time changes at run-time. For models that contain these blocks, change the sample time in the model first, then build that model. Although the xPC Target product allows you to change sample times at run-time, changing them at run-time for these blocks might cause incorrect results. |
The following table compares the interfaces supported by the xPC Target product.
Interface | Environment Properties | Control | Signal Acquisition | Parameter Tuning |
|---|---|---|---|---|
X | X | X | X | |
X | X | X | X | |
X | X | |||
X | ||||
X | X | X | ||
X | X | X | ||
X | X | X | ||
X | X | X |
The xPC Target software offers a graphical user interface (GUI) for configuring the host and target PCs and interacting with a target application. To open the xPC Target GUI, in the MATLAB Command Window, type xpcexplr.
The xPC Target Explorer is an all-in-one user interface that includes the following functionality.
Environment — Use the xPC Target Explorer to change properties in the xPC Target environment.
For more information on environment properties, see
Working with Target PC Environments in the xPC Target User's Guide
The getxpcenv function in the xPC Target User's Guide
Control — Use the xPC Target Explorer to download a model. After the target application is downloaded to the target PC, you can use xPC Target Explorer to run it. Use xPC Target Explorer to change stop time and sample times without regenerating code, and get statistical performance information during or after the last run.
Signal acquisition — Use the xPC Target Explorer Model Hierarchy node to interactively add scopes of type host, target, or file, and add or remove signals.
For more information on using scopes with the xPC Target Explorer, see Signals and Parameters in the xPC Target User's Guide.
Parameter tuning — Use the xPC Target Explorer Model Hierarchy node to change tunable parameters in your target application.
For more information, see Signals and Parameters in the xPC Target User's Guide.
You can interact with the xPC Target environment through the MATLAB command-line interface. Enter xPC Target functions in the MATLAB window on the host PC. You can also write your own M-file scripts that use xPC Target functions for batch processing.
The xPC Target software has more than 90 MATLAB functions for controlling the target application from the host computer. These functions define, at the most basic level, what you can do with the xPC Target environment.
The GUIs provided with the xPC Target product are for completing the most common tasks. They use the xPC Target functions but do not extend their functionality. The command-line interface provides an interactive environment that you can extend.
The MATLAB command-line interface includes the following functions:
Environment — Create a boot disk or network boot image and directly change the environment properties without using a graphical interface.
For more information on environment properties, see Creating a 3.5-Inch Target Boot Disk with a Command-Line Interface, and Software Environment and Demos in the xPC Target User's Guide.
Control — Reboot the target PC, download a target application, start and stop target applications, and change start and sample times without regenerating code. Get statistical performance information during or after the last run. Add and remove scopes, add/remove signals to scopes, and define triggers for scope display.
For more information, see Control with MATLAB Commands in xPC Target Getting Started Guide and Software Environment and Demos in the xPC Target User's Guide.
Signal acquisition — Trace signals for viewing while the target application is running and monitor signal values without time information. Transfer logged signal data to the MATLAB workspace by uploading from the target PC to the host PC between runs. For stand-alone target PCs, if you write signal data to a file, use the ftp utility to transfer that file to a remote PC.
For more information, see Signal Monitoring with the MATLAB Interface Signal Tracing with the MATLAB Interface and Signal Logging in the MATLAB Interface, and Targets and Scopes in the MATLAB Interface in the xPC Target User's Guide.
Parameter tuning — Change parameters while the target application is running, and use xPC Target functions to change parameters in between runs.
For more information, see Parameter Tuning with the MATLAB Interface and Targets and Scopes in the MATLAB Interface in the xPC Target User's Guide.
Use Simulink in external mode to connect your Simulink block diagram to your target application. The block diagram becomes a graphical user interface to the target application running in real time. By changing parameters in the Simulink blocks, you also change parameters in the target application.
The Simulink external mode interface includes the following functions:
Control — Control is limited to connecting the Simulink block diagram to the target application, and starting and stopping the target application.
For more information, see Signal Tracing with Simulink External Mode in the xPC Target User's Guide.
Signal acquisition — You can use Simulink external mode to establish a communication channel between your Simulink block diagram and your target application. The block diagram becomes a graphical user interface to your target application and Simulink scopes can acquire signal data from the target application. For more information, see Signal Tracing with Simulink External Mode in the xPC Target User's Guide.
Parameter tuning — Select external mode, and change parameters in the target application by changing parameters in the Block Parameters dialog boxes. Once you change a value and click OK, the new value is downloaded to the target PC and replaces the existing parameter while the target application continues to run. For more information, see Parameter Tuning with Simulink External Mode.
Note Opening a dialog box for a source block causes Simulink to pause. While Simulink is paused, you can edit the parameter values. You must close the dialog box to have the changes take effect and allow Simulink to continue. |
For more information, see Parameter Tuning with Simulink External Mode in the xPC Target User's Guide.
An alternative to interactively adding scopes to the target PC is to add xPC Target Scope blocks to your Simulink model. After the download process, these blocks create scopes on the target PC during initialization of the target application. You can choose to display data on either the host PC or target PC. You can also choose to save signal data (log real-time data stream) to a file in the target PC file system and transfer that file to another PC.
Signal acquisition — Add scopes to the target PC by adding xPC Target Scope blocks to your Simulink model. In the Block Parameters dialog box, select the scope mode and set the trigger.
For information on acquiring signal data with the xPC Target product, see Adding an xPC Target Scope Block, Entering Parameters for an xPC Target Scope Block, Entering Parameters for an xPC Target Scope of Type File, and Signal Tracing with xPC Target Scope Blocks in the xPC Target User's Guide.
You can interact with the xPC Target environment through the target PC command window. Enter commands in the command line on the target PC. This interface is useful with stand-alone applications that are not connected to the host PC.
The target PC command-line interface includes the following functions:
Control — Start and stop the target application, and change the stop time and sample time.
For more information, see Using the Target PC Command-Line Interface in the xPC Target User's Guide.
Signal acquisition — Acquiring signal data is limited to viewing signal traces and signal monitoring on the target PC screen.
Parameter tuning — You can change only scalar parameters in your model.
If the target PC is connected to a network (TCP/IP), you can use a Web browser to interact with the target application from any computer connected to the network. If the target PC is connected to the host PC with an RS-232 cable, and is using the TCP/IP to RS-232 gateway, you can use a Web browser on the host PC.
The Web browser interface includes the following functions:
Control — Start and stop the target application, and change the stop time and sample time.
For more information, see xPC Target Web Browser Interface in the xPC Target User's Guide.
Signal acquisition — Signal tracing is limited to viewing a snapshot of a screen captured from the target PC screen. Add scopes of type target, add or remove signals, and set triggering modes. You can also monitor signal values.
For more information, see Signal Logging with a Web Browser in the xPC Target User's Guide.
Parameter tuning — Change parameters in an HTML form, and then submit that form to make the changes in your target application.
For more information, see Parameter Tuning with a Web Browser in the xPC Target User's Guide.
Create a GUI application interface to a target application using any development environment that can link in a DLL.
Use the GUI application to control the application, tune parameters, and acquire signal data from a target application. The custom GUI runs on the host PC and communicates with the target application on the target PC using RS-232 or TCP/IP communication. A GUI application can be a console or Windows application using ActiveX® components.
For more information, see the xPC Target API Guide.
Create a GUI application that interfaces with a target application using Visual Basic® or any development environment that can incorporate COM objects. These COM objects connect graphic elements to parameters for parameter tuning, and they connect signals for acquiring data from your target application. To create a custom GUI application connected to an xPC Target application, use the following process:
Optionally, tag parameters and signals in the Simulink model.
If you tag parameters and signals, build the model-specific COM library.
For more information, see the xPC Target API Guide.
![]() | Software Environment | Installation and Configuration | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |