This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

SimulinkRealTime.utils.getConsoleLog

Retrieve the log that the kernel writes to the target computer screen

Syntax

console_log = SimulinkRealTime.utils.getConsoleLog(target_name,sequence_number)
console_log = SimulinkRealTime.utils.getConsoleLog(target_object,sequence_number)

Description

example

console_log = SimulinkRealTime.utils.getConsoleLog(target_name,sequence_number) retrieves the log from the target computer, target_name, for lines equal to or greater than the sequence number. If the target_name is omitted, the function returns the console log of the default target computer (for example, 'TargetPC1'). If the sequence_number is omitted, the function returns lines from the default sequence (for example, 0). If no lines have such a sequence number, the function returns an empty array.

The console_log is an array of structures, one per line of text in the console. Each structure has the following fields:

  • sequence: Absolute sequence number of the console line, after target reboot.

  • attrib: The type of message the line represents:

    • 0 - normal messages

    • 1 - warning messages

    • 2 - error messages

  • text: The text of the console line. The text does not include a line termination character (for example, '\n').

example

console_log = SimulinkRealTime.utils.getConsoleLog(target_object,sequence_number) retrieves the log from the target computer identified by the object, target_object.

Examples

collapse all

Get the console log for the default target computer starting from sequence number 0.

console_log = SimulinkRealTime.utils.getConsoleLog
% if the default target computer is TargetPC1, 
% this function is equivalent to:
% console_log = SimulinkRealTime.utils.getConsoleLog('TargetPC1',0)
console_log =

1×13 struct array with fields:

sequence
attrib
text
console_log(1)
ans =

struct with fields:

sequence: 0
attrib: 0
text: 'Starting up with 1 CPU'

Get the console log for a target computer selected with a target object, starting from a specific sequence number.

tg=slrt;
console_log = SimulinkRealTime.utils.getConsoleLog(tg,5)
console_log =

1×8 struct array with fields:

sequence
attrib
text
console_log(1)
ans =

struct with fields:

sequence: 5
attrib: 0
text: 'Download finished'

Input Arguments

collapse all

Example: 'TargetPC1'

Data Types: char | string

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

The target computer log sequence number indicates the line number from the beginning of last reboot, starting from 0. This number does not necessarily match the line number displayed on the screen or observed at the buffer.

Example: 5

Output Arguments

collapse all

The function returns the console log as a vector of structures consisting of the fields: sequence, attrib, and text.

Introduced in R2017a