Acquire Signal Data with File Scopes

You can acquire signal data into a file on the target computer. To do so, you can include a real-time file scope in your Simulink® Real-Time™ model. Alternatively, after you build the real-time application and download it to the target computer, you can add a file scope to that application.

For example, to add a file scope named sc to the real-time application, and to add signal 4 to that scope:

  1. In the MATLAB® window, type:

    tg = slrt;
    sc = addscope(tg, 'file')

    The Simulink Real-Time software creates a file scope for the real-time application.

  2. To add signal 4, type:

    addsignal(sc, 4)
  3. 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 the scope, type:

    start(sc)
  4. To start the real-time application, type:

    start(tg)

The Simulink Real-Time software adds signal 4 to the file scope. When you start the scope and the real-time application, the scope saves the signal data for signal 4 to a file, by default named C:\data.dat.