MATLAB: Am I having difficulties uploading data types, other than double, from the xPC Target application

dataintegerSimulink Real-Timetargettypeuploadxpcxpcscope

Why am I having difficulties uploading data types, other than double, from my xPC Target application?
I have a simple Simulink model which produces an integer array in the MATLAB workspace. It uses a type conversion to convert data to 16 bit signed integer. The yout data can be plotted and confirmed to be integer.
When the identical model is compiled for an xPC target, executed on that target and the output log uploaded, the resulting data appears to be invalid. The host interprets it as floating point data smaller than REALMIN.
How can I log integer data on an xPC target and upload and interpret it correctly it after a run?

Best Answer

This enhancement has been incorporated in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
You were not able to log your data in the right format because xPC Target currently does not support this through the MATLAB Command Prompt. You can verify this by opening the RTW page from your Simulink Model. Click on Tools/Real-Time Workshop/Options to get to the RTW page. Then choose the 'xPC Target Code Generation Options' category . As you can see, the Signal Logging Buffer Size is in Doubles.
As a workaround please use the XPCSCOPE tool to export your data. The XPCSCOPE is useful for Signal Tracing from xPC Target. A tutorial on how to use this tool is available in the xPC Target User's Guide:
web([docroot '/toolbox/xpc/ch_basic_tutorial8.html'])
A summary of the steps to follow are:
1. Type the following at the MATLAB Command Prompt:
xpcscope
2. Click File/New Scope
3. Open your model and build it onto the target
4. From the xPC Scope window click on Add/Remove Signals
5. Choose a signal to add and click on the Add Signal button
6. From the MATLAB Command prompt type:
tg.start
7. Now click on the start button inside the xPC Scope window
8. Wait for the scope to collect the number of samples you entered, or in the Scope window, click the Stop button.
9. In the xPC Target Scope window, and from the Plot menu, click Variable Name for Export. You can change those variables and then click on Apply and then click Close
10. The Export button is then useful to export your data after a run or durring a run of your target application