| Contents | Index |
| On this page… |
|---|
Setting Your Initial Working Folder |
You install the xPC Target software only on the host computer. The host computer downloads the kernel software and target application to the target computer at runtime. The xPC Target software is distributed on a DVD or as a file you download from the Web.
Note Before you start, verify that the xPC Target and xPC Target Embedded Option products are not already installed on your host computer. If they are, uninstall them both before proceeding. |
After you install the product, you will need to set up the xPC Target environment for either serial or network communication. See Serial Communication or Network Communication.
If you have purchased an xPC Target Turnkey system, install your MATLAB products on your system before installing xPC Target Turnkey software. See your system user documentation for further information.
Before you install the xPC Target or the xPC Target Embedded Option products, you must have a valid File Installation Key and License File. The File Installation Key identifies the products you purchased from MathWorks and are permitted to install and use. The License File activates the installation.
If you have not received either of these, go to the License Center at the MathWorks Web site.
The xPC Target family of software includes options that you can purchase and add later to the xPC Target environment.
xPC Target Embedded Option product — With the xPC Target Embedded Option product, you can boot the target computer from a device other than a floppy disk or CD/DVD and deploy standalone target applications separate from the host computer.
When using the xPC Target software, you might find it helpful to know where files are located:
MATLAB working folder — Simulink models (model.mdl), xPC Target applications (model.dlm)
Select a working folder outside the MATLAB root. See Setting Your Initial Working Folder.
Simulink Coder Build folder — The Simulink Coder C code files (model.c, model.h) are in a subfolder called modelname_xpc_rtw.
The xPC Target software uses the directories and files located in matlabroot\toolbox\rtw\targets\xpc\
target — Files and functions related to the xPC Target kernel and build process, including drivers to support I/O blocks
xpc — Host computer functions related to all of the xPC Target software, methods for target objects, and methods for scope objects
xpcdemos — Simulink models and MATLAB code demos
You should set your MATLAB working folder outside the MATLAB root folder. The default MATLAB root folder is c:\matlab.
If your MATLAB working folder is below or inside the MATLAB root, files created by Simulink and Simulink Coder are mixed with the MATLAB directories. This mixing of files could cause file management problems.
Your initial working folder is specified in the shortcut file you use to start MATLAB. To change this initial folder, use the following procedure:
Right-click the MATLAB desktop icon or, from the program menu, right-click the MATLAB shortcut.
Click Properties. In the Start in text box, enter the folder path you want MATLAB to use initially. Make sure you choose a folder outside the MATLAB root folder.
Click OK, and then start MATLAB. To check your working folder, in the MATLAB Command Window, type
pwd
To temporarily set your MATLAB working folder, use the following procedure:
In the MATLAB Command Window, type
cd c:\<MATLAB working folder>
To check your working folder, type
pwd or cd
To permanently set your working folder, see From the Desktop Icon.
If you are running MATLAB remotely (accessing MATLAB over the network), register Active X controls before you start xPC Target Explorer.
In the MATLAB Command Window, type
xpc_register_ocx
This function registers the Active X controllers that xPC Target Explorer requires.
You are now ready to start xPC Target Explorer.
To configure the host computer for your compiler, use xPC Target Explorer.
If xPC Target Explorer is not already open, in the MATLAB Command Window, type
xpcexplr
Note xPC Target Explorer runs only on 32-bit host computers. On 64-bit computers, use the MATLAB command-line interface. For further information, see Configuring Environment From the MATLAB Command Line. |
The xPC Target Explorer window appears.

xPC Target Explorer includes a default target computer node in its configuration, marked with boldface. In a multitarget environment, this visual aid helps you easily identify the default target computer.
In the xPC Target Explorer window, select the Compiler(s) Configuration node.
In the right pane, the compiler parameters appear.
At the Select C Compiler drop-down list, select the compiler you have installed on the host computer. The examples in this chapter use VisualC.
Enter the path (or browse) to the compiler for Compiler Path. For example,
C:\Applications\Microsoft Visual Studio

Note xPC Target Explorer dialogs highlight a field and enable the Revert and Apply buttons when you make changes. To apply changes, click Apply. A prompt is displayed if you leave a dialog without first saving changes. If you want the original entry to be displayed, click the Revert button and do not click the Apply button. If you click Apply, you cannot retrieve the original entries. |
To configure the host computer for the C compiler:
In the MATLAB Command Window, type
xpcsetCC('setup')The function queries the host computer for C compilers that the xPC Target environment supports. It returns output like the following:
Select your compiler for xPC Target.
[1] Microsoft Visual C++ Compilers 2008 Professional Edition (SP1) in
c:\Program Files (x86)\Microsoft Visual Studio 9.0
[2] Microsoft Visual C++ Compilers 2010 Professional in
C:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler:At the Compiler prompt, enter the number for the compiler you want to use. For example, 2.
The function verifies that you have selected the required compiler:
Verify your selection: Compiler: Microsoft Visual C++ Compilers 2010 Professional Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0 Are these correct [y]/n?
Type y or press Enter to verify the selection.
The function finishes the dialog.
Done...
To install Microsoft .NET Framework from the xPC Target installation directory:
Navigate to matlabroot\toolbox\rtw\targets\xpc\xpc\bin\dotnetfx
Click dotNetFx40_Full_x86_x64.exe
![]() | Target Computer Configuration | Network Communication | ![]() |

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