Configure File Scopes with Simulink Real-Time Explorer

You can configure your file scopes to facilitate data logging. You can configure a file scope whether you added a Scope block to your model or added the scope at run time.

This procedure uses the model xpcosc. You must have already completed the procedure in Create File Scopes with Simulink Real-Time Explorer. Target execution and scopes must be stopped.

  1. Select Scope 1, and then open the Properties pane ( on the Scopes toolbar).

  2. In the Scope 1 Properties pane, click File.

  3. Enter a name in the File name text box, for example scope2.dat.

    File names on the target computer are limited to eight characters in length, not counting the file extension. If the name is longer than eight characters, the software truncates it to six characters and adds '~1' to the end of the file name.

    If you enter just the file name, the file appears in folder C:\. To put the file in a folder, create the folder separately using the target computer command line or MATLAB® language.

    A fully qualified file name in the operating system on the target computer can have a maximum of 260 characters. If the file name is longer than eight-dot-three format (eight character file name, period, three character extension), the operating system represents the file name in truncated form (for example, six characters followed by '~1'). MATLAB commands can access the file using the fully qualified file name or the truncated representation of the name. Some block parameters, such as the Scope block filename parameter, require 8.3 format for the file name.

    If a file with this name exists when you start the file scope, the file scope overwrites the old data with the new data.

  4. Select File mode Commit.

    The default File mode is Lazy. When real-time execution stops without an error, both the Lazy and Commit settings of the Mode box have the same result. Both settings cause the model to open a file, write signal data to the file, and close that file at the end of the session. The differences are in when the software updates the FAT entry for the file.

    • In Commit mode, the FAT entry and the actual file size are updated during each file write operation.

    • In Lazy mode, the FAT entry and the actual file size are updated only when the file is closed and not during each file write operation.

    Lazy mode is faster than Commit mode. However, if the target computer enters an error state, the system can stop responding before the file is closed. In Lazy mode, the actual file size can be lost, even though the file was written. You can lose an amount of data equivalent to the setting of the WriteSize parameter.

  5. 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.

  6. Leave the Dynamic File Mode check box cleared.

  7. Leave Write Size set to the default value of 512.

    Using a block size that is the same as the disk sector size improves performance.

  8. Leave Max write file size set to the default value, which is a multiple of Write Size.

  9. Start execution ( on the Applications toolbar).

  10. 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.

    Start Scope 1( on the Scopes toolbar). Let it run for up to a minute.

  11. Stop Scope 1 ( on the Scopes toolbar).

  12. Stop execution ( on the Applications toolbar).

  13. 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.

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

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

See Also

| |

Related Topics