Main Content

Set Run in Kernel Mode Properties for Logging to File

Data is saved to a file by first saving the data to the MATLAB® workspace through a Simulink® Scope block. Before running a real-time application, set signal and triggering properties.

After you create a Simulink model and add a Scope block, you can enter the signal and triggering properties for data logging to a file.

This procedure uses the model sldrtex_model. To open this model, in the MATLAB Command Window, type:

openExample('sldrtex_model')

The steps in this procedure assume that you have already loaded that model and have completed the steps in Set Scope Parameters for Logging to File.

  1. In the Simulink Editor, on the Desktop Real-Time tab, click Prepare > Control Panel.

  2. In the External Mode Control Panel, click the Signal & Triggering button.

  3. Click the Select all check box. From the Source list, select manual. From the Mode list, select normal.

    The X under Signal selection designates that a signal has been tagged for data collection, and T designates that the signal has been tagged as a trigger signal.

  4. In the Duration field, enter the number of sample points in a data buffer. Enter a Duration value equal to the total number of sample points that you must collect for a run. For example, if you have a sample rate of 1000 samples/second and a stop time of 10 seconds, enter:

    10001

    Set the time axis for Simulink Scope blocks equal to the sample interval (in seconds) times the number of points in each data buffer. This setting displays one buffer of data across the entire Simulink Scope plot.

  5. Clear the Limit data points to last check box. See Set Scope Parameters for Logging to Workspace.

    For more information, see External Mode Simulation with TCP/IP or Serial Communication (Simulink Coder).

    Use the external signal and triggering window to apply these settings.

  6. Click OK.

    In the External Signal & Triggering dialog box, click the OK button for the changes you made to take effect. You do not have to rebuild your real-time application.

Related Topics