getlog

Portion of output logs from target object

Description

example

log = getlog(target_object, log_name) returns all the samples from a log of type log_name, starting from the first point without decimation.

example

log = getlog(target_object, log_name, first_point) returns the sample at first_point from a log of type log_name.

example

log = getlog(target_object, log_name, first_point, number_samples) returns number_samples samples from a log of type log_name, starting from first_point without decimation.

example

log = getlog(target_object, log_name, first_point, number_samples, decimation) returns number_samples samples from a log of type log_name, starting from first_point, with a decimation of decimation.

Examples

collapse all

Read the TimeLog and OutputLog samples from model xpcosc using the default settings. Plot the results.

Read TimeLog and OutputLog samples

tg = slrt;
timelog = getlog(tg, 'TimeLog');
outputlog = getlog(tg, 'OutputLog');

Plot the data

plot(timelog, outputlog);

Read 10 samples starting from 5 of TimeLog and OutputLog

Read 5 TimeLog samples

tg = slrt;
timelog = getlog(tg, 'TimeLog', 5, 10)
timelog =

    0.0010
    0.0013
    0.0015
    0.0018
    0.0020
    0.0023
    0.0025
    0.0027
    0.0030
    0.0033

Read 10 OutputLog samples

outputlog = getlog(tg, 'OutputLog', 5, 10)
outputlog =

   -1.6200   -4.0000
   -2.3450   -4.0000
   -3.0990   -4.0000
   -3.8345   -4.0000
   -4.5098   -4.0000
   -5.0907   -4.0000
   -5.5518   -4.0000
   -5.8772   -4.0000
   -6.0606   -4.0000
   -6.1046   -4.0000

Plot the data

plot(timelog, outputlog);

Read 10 samples at decimation 2 starting from 5 of TimeLog and OutputLog

Read 5 TimeLog samples

tg = slrt;
timelog = getlog(tg, 'TimeLog', 5, 10, 2)
timelog =

    0.0010
    0.0015
    0.0020
    0.0025
    0.0030
    0.0035
    0.0040
    0.0045
    0.0050
    0.0055

Read 10 OutputLog samples

outputlog = getlog(tg, 'OutputLog', 5, 10, 2)
 -1.6200   -4.0000
   -3.0990   -4.0000
   -4.5098   -4.0000
   -5.5518   -4.0000
   -6.0606   -4.0000
   -6.0199   -4.0000
   -5.5384   -4.0000
   -4.8028   -4.0000
   -4.0224   -4.0000
   -3.3784   -4.0000

Plot the data

plot(timelog, outputlog);

Read one sample starting from sample 8 of TimeLog and OutputLog

Read 5 TimeLog samples

tg = slrt;
timelog = getlog(tg, 'TimeLog', 8)
timelog =

    0.0018

Read 10 OutputLog samples

outputlog = getlog(tg, 'OutputLog', 8)
outputlog =

   -3.8345   -4.0000

Input Arguments

collapse all

Object that represents the target computer. Before calling this function, make sure that you start the target computer with the Simulink® Real-Time™ kernel and apply the required Ethernet link settings.

Example: tg

  • TimeLog — Timestamps for each logged value

  • StateLog — Discrete and continuous state of blocks

  • OutputLog — Value of root-level outport blocks

  • TETLog — Task execution times (TET)

Example: 'Timelog'

Data Types: char

If specified without number_samples, this parameter returns only the value at first_point.

Example: 10

Number of samples to retrieve starting with first_point, after decimation.

Example: 10

If 1, returns all sample points. If n, returns every nth sample point.

Must be used with first_point and number_samples.

Example: 2

Output Arguments

collapse all

Variable receives the log entries as a matrix

Introduced in R2014a