Main Content

sldiagviewer.diary

Log simulation warnings and errors and build information to file

Description

example

sldiagviewer.diary intercepts build information, warnings, and errors transmitted to the Command Window or the Diagnostic Viewer and logs them to a text file diary.txt in the current folder.

example

sldiagviewer.diary(filename) toggles the logging state of the text file specified by filename.

example

sldiagviewer.diary(toggle) turns logging to the log file on or off. The setting applies to the last file name you specified for logging or to diary.txt if you did not specify a file name.

example

sldiagviewer.diary(filename,'UTF-8') specifies the character encoding for the log file filename.

Examples

collapse all

Start logging build information and simulation warnings and errors to diary.txt.

sldiagviewer.diary
open_system('vdp')
rtwbuild('vdp')

Open diary.txt to view logs.

### Starting build procedure for model: vdp
### Build procedure for model: 'vdp' aborted due to an error.
...

Set up logging to a file.

sldiagviewer.diary('C:\MyLogs\log1.txt')

Switch the logging state of a file.

sldiagviewer.diary('C:\MyLogs\log1.txt') % Start logging
open_system('vdp')
rtwbuild('vdp')

sldiagviewer.diary('off') % Switch off logging
open_system('sldemo_fuelsys')
rtwbuild('sldemo_fuelsys')

sldiagviewer.diary('on') % Resume logging

Set the file name to log to and the character encoding to use.

sldiagviewer.diary('C:\MyLogs\log1.txt','UTF-8')

Input Arguments

collapse all

Logging state, specified as 'on' or 'off'.

Example: sldiagviewer.diary('on')

Name of file to log data to, specified as a character vector.

Example: sldiagviewer.diary('C:\Simulations\mySimulationDiary.txt')

Introduced in R2014a