Create File Scopes with Simulink Real-Time Explorer

You can create a file scope on the target computer using Simulink® Real-Time™ Explorer. These scopes have the full capabilities of the Scope block in File mode, but do not persist past the current execution.

Note

For information on using file scope blocks, see Configure Real-Time File Scope Blocks and File Scope Usage.

This procedure uses the model xpcosc. You must have already completed the following setup:

  1. Built and downloaded the real-time application to the target computer using Simulink ( on the toolbar).

  2. Run Simulink Real-Time Explorer (Tools > Simulink Real-Time).

  3. Connected to the target computer in the Targets pane ( on the toolbar).

  4. Set property Stop time to inf in the Applications pane ( on the toolbar).

To configure a file scope:

  1. In the Scopes pane, expand the xpcosc node.

  2. To add a file scope, select File Scopes, and then click the Add Scope button  on the toolbar.

  3. Expand Scope 1, and then click the Properties button  on the toolbar.

  4. In the Scope Properties pane, click Signals.

    Add signals from the Applications Signals workspace.

  5. In the Applications pane, expand both the real-time application node and the node Model Hierarchy.

  6. Select the model node and then click the View Signals button  on the toolbar.

  7. In the Signals workspace, to add signal Signal Generator to Scope1, drag signal Signal Generator to the Scope1 properties workspace.

  8. Add signal Integrator1 to Scope 1 in the same way.

  9. In the Scope Properties pane, click File.

  10. Enter a name in the File name text box, for example scope1.dat.

  11. To have the file scope collect data up to Number of samples and then start over again reading new data, select the AutoRestart check box.

  12. Leave the Dynamic File Mode check box cleared.

  13. To start execution, click the real-time application and then click the Start button  on the toolbar.

  14. Caution

    Before starting the scope, copy previously acquired data to the development computer. When the file scope starts, the software overwrites previously acquired data in files of the specified name or name pattern. A partially overwritten file or a file that is opened but left unwritten loses its original contents.

    To start Scope 1, click Scope 1 in the Scopes pane, and then click the Start Scope button  on the toolbar.

  15. To stop Scope 1, click Scope 1 in the Scopes pane, and then click the Stop Scope button  on the toolbar.

    For file scopes, before adding or removing signals, stop the scope first.

  16. To stop execution, click the real-time application, and then click the Stop button  on the toolbar.

  17. To view the file that you generated, in the Targets pane, expand the target computer and then double-click File System.

  18. Select C:\. The dialog box looks like this figure.

  19. To retrieve the file from the target computer, select the file in the target computer File System pane. Drag it to the MATLAB® Current Folder pane or to a Windows® Explorer window.

You can create a file scope from the list of scope types by clicking Add Scope next to scope type File Scopes.

To rename file SCOPE1.DAT, right-click the file name, select Rename, type the new name in the text box, and then click Enter.

To delete file SCOPE1.DAT, right-click the file name and select Delete.

To make both workspaces visible at the same time, drag one workspace tab down until the  icon appears in the middle of the dialog box. Continue to drag the workspace until the cursor reaches the required quadrant, and then release the mouse button.

To save your Simulink Real-Time Explorer layout, click File > Save Layout. In a later session, you can click File > Restore Layout to restore your layout.

See Also

|

Related Topics