Main Content

Set Run in Kernel Mode Properties for Logging to Workspace

Data is saved to the MATLAB®workspace through a Simulink®Scopeblock. Set signal and triggering properties only when you are running a real-time application. If you are running aConnected IOmode or accelerator mode simulation, you can skip this procedure.

After you create a Simulink model and add aScopeblock, you can enter the signal and triggering properties for logging to the MATLAB workspace.

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

open_system(docpath(fullfile(docroot,'toolbox',...'sldrt','examples',“sldrtex_model”)))

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

  1. In the Simulink Editor, on theDesktop Real-Timetab, clickPrepare>控制面板.

  2. In the External Mode Control Panel, click theSignal & Triggeringbutton.

  3. Click theSelect allbutton. From theSourcelist, selectmanual. From theModelist, selectnormal.

    TheXunderSignal selectiondesignates that a signal has been tagged for data collection, andTdesignates that the signal has been tagged as a trigger signal.

  4. In theDurationfield, enter the number of sample points in a data buffer. Enter aDurationvalue 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 SimulinkScopeblocks 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 SimulinkScopeplot.

  5. Clear theLimit data points to lastcheck box. SeeSet Scope Parameters for Logging to Workspace.

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

    Image of external signal and triggering window

  6. ClickOK.

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

Related Topics