Main Content

slrealtime.fileLogImport

After copying file logs from target to development computer, import file logs into Simulation Data Inspector

Since R2021a

Description

example

slrealtime.fileLogImport(app_name,'Directory',apps_path) imports file logs into the Simulation Data Inspector after you have copied the files from the target computer into the development computer applications folder tree under the specified folder apps_path.

Use the slrealtime.fileLogImport workflows when working with a standalone target computer that does not connect to Simulink Real-Time. If working with a target computer that connects to Simulink Real-Time on the development computer, use the import function or Import File Log button in the Simulink Real-Time Explorer.

example

slrealtime.fileLogImport(app_name) imports the logs for the selected real-time application name (string) into the Simulation Data Inspector after you have copied the files from the target computer into the development computer applications folder tree under the current folder pwd.

example

slrealtime.fileLogImport(run_table) imports the file logs for the selected run table (table) into the Simulation Data Inspector after you have copied the files from the target computer into the development computer applications folder tree under the current folder pwd.

example

slrealtime.fileLogImport(run_number) imports the file logs for the select row number (numeric) into the Simulation Data Inspector after you have copied the files from the target computer into the development computer applications folder tree under the current folder pwd.

Examples

collapse all

  1. Open model slrt_ex_osc.

  2. In the Simulink Editor, from the Real-Time tab, click Hardware Settings.

  3. In the Simulink Real-Time Options pane, change Max file log runs to 5 and click OK.

  4. Click Run on Target.

  5. After the run ends, close the model and exit MATLAB.

Because this example shows how to use the slrealtime.fileLogImport function to import file logs that are created on a disconnected target computer, the example shows how to start the real-time example by using an SSH session from the target computer command line. If you are starting the real-time application from MATLAB and are using slrealtime.fileLogImport, consider using the 'FileLogMaxRuns' argument and the 'AutoImportFileLog' argument for the start function.

  1. Start an SSH session by using PuTTY. Log into the target computer as user slrt with password slrt. For more information about settings for using PuTTY for an SSH session, see Execute Target Computer RTOS Commands at Target Computer Command Line.

  2. After you log in, load and run the application to generate file logs. The target computer stores up to the maximum number of logs, in this case 5. At the target computer prompt, type:

    slrealtime load --AppName slrt_ex_osc
    slrealtime start
  3. Repeat the previous step until you have created several logs. Between each run, you can change parameter values by loading different parameter set files into the application. For more information, see the loadParamSet function.

  4. List the logs that you created. At the target computer prompt, type:

    ls applications/slrt_ex_osc/logdata/
  1. On the development computer, use a system utility to copy the applications folder tree from the target computer to an applications folder on the development computer. For example on a Windows® development computer, you can use pscp (a PuTTY utility), Filezilla, or a MATLAB® ftp object. You can download and install PuTTY from www.putty.org. In the MATLAB Command Window, type:

    system('pscp -r slrt@192.168.7.5:applications C:\work\my_applications\')
  2. List the file logs that are available to import into the Simulation Data Inspector. In the MATLAB Command Window, type:

    slrealtime.fileLogList('Directory','C:\work\my_applications\')
  3. Import the file logs into the Simulation Data Inspector. In the MATLAB Command Window, type:

    slrealtime.fileLogImport('slrt_ex_osc',...
        'Directory','C:\work\my_applications\')

    The simulation runs are available in the Simulation Data Inspector under the Archive list.

If you have previously copied and imported log files, you can reduce your copying steps and time the next time you follow the process to copy files and import logs.

  1. Assuming that you have previously completed the process described in Copy File Logs from Target Computer and Import Folder and your real-time application on the target computer has not changed since following those steps, use a system utility on your development computer to copy the relevant applications/appname/logdata/run_number folder from the target computer to a run folder on the development computer. This example copies folder run_5 for application slrt_ex_osc. In the MATLAB Command Window, type:

    system('pscp -r slrt@192.168.7.5:applications/slrt_ex_osc/logdata/run_5 C:\work\my_applications\applications\slrt_ex_osc\logdata\run_5\')
  2. To import the file log on the development computer, follow the import steps in Copy File Logs from Target Computer and Import Folder.

  1. After you copy the applications folders from the target computer to an applications folder on the development computer, you can list the file logs that are available to import into the Simulation Data Inspector. With the current folder set to the parent of the applications folder tree, in the MATLAB Command Window, type:

    my_list = slrealtime.fileLogList()
    my_list =
    
      4×3 table
    
               Application          StartDate             Size   
              _____________    ____________________    __________
    
        1.    "slrt_ex_osc"    22-Aug-2020 20:10:44    1.2803e+05
        2.    "slrt_ex_osc"    22-Aug-2020 20:11:18    1.2803e+05
        3.    "slrt_ex_osc"    22-Aug-2020 20:11:53    1.2803e+05
        4.    "slrt_ex_osc"    22-Aug-2020 20:12:34    1.2803e+05
    
  2. Import the file logs table into the Simulation Data Inspector. In the MATLAB Command Window, type:

    slrealtime.fileLogImport(my_list)

    The simulation runs are available in the Simulation Data Inspector.

  1. After you copy the applications folders from the target computer to an applications folder on the development computer, you can list the file logs that are available to import into the Simulation Data Inspector. With the current folder set to the parent of the applications folder, in the MATLAB Command Window, type:

    slrealtime.fileLogList()
    ans =
    
      4×3 table
    
               Application          StartDate             Size   
              _____________    ____________________    __________
    
        1.    "slrt_ex_osc"    22-Aug-2020 20:10:44    1.2803e+05
        2.    "slrt_ex_osc"    22-Aug-2020 20:11:18    1.2803e+05
        3.    "slrt_ex_osc"    22-Aug-2020 20:11:53    1.2803e+05
        4.    "slrt_ex_osc"    22-Aug-2020 20:12:34    1.2803e+05
    
  2. Import the file log for a selected run into the Simulation Data Inspector. In the MATLAB Command Window, type:

    slrealtime.fileLogImport(1)

    The simulation data for run 1 are available in the Simulation Data Inspector.

Input Arguments

collapse all

Provides name of real-time application MLDATX file that you built from the model.

Example: 'slrt_ex_osc'

Provides a number for a simulation run file log in the table of available simulation runs.

Example: 1

Provides a handle to a simulation run file log table.

Example: my_list

Provides the path to the applications folder on the development computer to which you have copied the tree of files from the applications folder on the target computer.

Example: (fullfile(pwd,'applications'))

Version History

Introduced in R2021a