MATLAB: How to develop a GUI that allows me to interact with the xPC Target application from the host machine

gaugesgraphicalguiinterfacem-apirealitysimulinkSimulink Real-Timesitplan_xpc_setupuservirtualxpc

I would like to develop a custom GUI that allows me to interact with my xPC Target application. However, I am unsure if this is possible.

Best Answer

It is possible to create a GUI that interacts with xPC Target. The available options are listed below.
1. Using the xPC Target M-API:
This method is well illustrated by the attached demo files "xPC_GUIdemo.m" and "xPC_GUIdemo.fig". The specific tasks that the demo GUI enables the user to achieve are:
a. Set xPC Target environment properties
b. Connect to Target machine
c. Download application
d. Start and Stop application
e. Tune a Parameter
f. Trace Signal(s) via host scope object
The example GUI uses the demo model "xpcosc.mdl" shipped with xPC Target and demonstrates tuning of the feedback gain and observing its effect on the system response. Before running the MATLAB file, build the xpcosc.mdl model by typing the following command while in the same directory as the demo files: rtwbuild('xpcosc').
2. Using the "To xPC Target" and "From xPC Target" blocks in Simulink 
You can use the blocks described above to connect to the Virtual Reality
Toolbox blocks, Altia Simulink blocks, and the Gauges Blockset blocks to xPC Target.
Altia comes with runtime modules capable of running stand-alone, therefore independent of the Altia designer. On the xPC Target side, you can use the xPC C-API to connect to the target and target application. By providing a simple gateway executable in between, Altia and xPC Target can be connected to execute in stand-alone mode, independent of the Altia Designer and MATLAB. The Web-downloadable C-API for xPC Target comes exactly with such an example for Altia. You may find the file under:
matlabroot\toolbox\rtw\targets\xpc\xpc\private
For more information on using the blocks in the Gauges Blockset, look at the following demo shipped with xPC Target:
help xpcgaugesdemo