Main Content

slrealtime.fileLogImport

Import file logs copied from target computer into Simulation Data Inspector

Description

example

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

example

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

example

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

example

slrealtime.fileLogImport(run_number) takes the file logs that you copied from the target computer into the applications folder tree under the current folder pwd for the select row number (numeric) and imports the log into the Simulation Data Inspector.

Examples

collapse all

Open model slrt_ex_osc.

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

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

Click Run on Target.

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.

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.

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

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.

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

$ ls applications/slrt_ex_osc/logdata/

On the development computer, use pscp (a PuTTY utility) to copy the applications folders from the target computer to an applications folder on the development computer. You can download and install this utility from www.putty.org. In the MATLAB Command Window, type:

system('pscp -r slrt@192.168.7.5:applications C:\work\my_logdata\')

List the file logs that are available to import into the Simulation Data Inspector. In the MATLAB Command Window, type:

slrealtime.fileLogList('Directory','applications')

Import the file logs into the Simulation Data Inspector. In the MATLAB Command Window, type:

slrealtime.fileLogImport('slrt_ex_osc',...
    'Directory',(fullfile(pwd,'applications')))

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

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:

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

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.

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

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'))

Introduced in R2021a