| 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… |
|---|
The Tcl/Tk demos are scripts that illustrate how to directly access xPC Target COM API functions through a command-line interpreter like Tcl/Tk. With Tcl/Tk
You can write simple command-line scripts that communicate with a target PC and the target application downloaded on that target PC.
You can write simple GUIs that you can use to interact with a target application downloaded on a target PC.
The files for this scripts are located in
C:\matlabroot\toolbox\rtw\targets\xpc\api\tcltk
xpcapi.dll — The xPC Target API DLL file. This file must be in the current (pwd) directory. Alternatively, you can copy the file xpcapi.dll into the Windows system directory.
xpcbase.tcl — Contains utility procedures used by the other scripts in the series
xpclists.tcl — Generates a list of signals or parameters for the target application currently loaded on the target PC
xpcload.tcl — Loads the specified target application to the connected target PC
xpcoutputlog.tcl — Reads log data from the target PC and plots the data on the host PC
xpcstart.tcl — Starts the target application loaded on the target PC
xpcstop.tcl — Stops the target application loaded on the target PC
xpctargetping.tcl — Tests the communication between the host and target PCs
xpctargetscope.tcl — Creates a simple GUI that enables you to add and control a scope of type target
xpctune.tcl — Creates a simple GUI slider that enables you to manipulate a parameter value for the target PC application
To use these Tcl/Tk scripts, or to write your own Tcl/Tk scripts, you need
An installation of a Tcl/Tk distribution on the host PC.
An add-on package to the Tcl/Tk interpreter so that the scripts can access the COM API objects. The tcom package is recommended. This package was used to create the demo scripts in the C:\matlabroot\toolbox\rtw\targets\xpc\api\tcltk directory.
The math::statistics package. This package is required for the xpcoutputlog.tcl file.
Note There are Tcl/Tk distributions that include required and useful packages for use with the xPC Target software. For example, the Tcl/Tk distribution at http://www.activestate.com contains these packages. |
The top of each Tcl/Tk script file contains directions on how to use each Tcl/Tk scripts. In general:
Copy the contents of the tcltk directory to a writable directory of your choice.
Change directory to the one that contains your copy of the Tcl/Tk script files.
Load the Tcl/Tk script with the source command. For example,
source xpctargetping.tcl
Run the loaded script. For example,
xpctargetping 192.168.0.10 22222
The selected script executes. In this example, xpctargetping.tcl tests the communication between the host and target PC and returns a success or failure message.
![]() | Microsoft Visual Basic 6.0 Demo | xPC Target API for Microsoft .NET Framework | ![]() |

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 |