Main Content

sldiagviewer.diary

Log diagnostic messages and build information in file

    Description

    example

    sldiagviewer.diary logs the warnings, errors, and build information in a text file diary.txt located in the current folder.

    example

    sldiagviewer.diary(filename) logs the diagnostic messages and build information in a text file filename located in the current folder.

    example

    sldiagviewer.diary(toggle) sets the logging state of the current log file as 'on'or 'off'.

    example

    sldiagviewer.diary(filename,'UTF-8') changes the character encoding for the log file filename from system default character encoding to UTF-8.

    Examples

    collapse all

    Log simulation warnings and errors of a model in a text file using sldiagviewer.diary.

    Create log file diary.txt and turn on logging.

    sldiagviewer.diary

    Load the model vdp.

    model = 'vdp';
    load_system(model);

    Introduce errors into the model.

    set_param('vdp/Mu','Gain','xyz') 

    Simulate the model vdp.

    set_param(model,'SimulationCommand','Start') 

    The errors are logged in diary.txt.

    Log simulation warnings and errors of a model in a specified text file using sldiagviewer.diary.

    Create log file mySimulationDiary.txt and turn on logging.

    sldiagviewer.diary('mySimulationDiary.txt')

    Load the model vdp.

    model = 'vdp';
    load_system(model);

    Introduce errors into the model.

    set_param('vdp/Mu','Gain','xyz') 

    Simulate the model vdp.

    set_param(model,'SimulationCommand','Start') 

    The errors are logged in mySimulationDiary.txt.

    Create log file using sldiagviewer.diary and toggle logging state.

    Create log file diary.txt and turn on logging.

    sldiagviewer.diary

    Load the model vdp.

    model = 'vdp';
    open_system(model);

    Introduce errors into the model.

    set_param('vdp/Mu','Gain','xyz') 

    Simulate the model.

    set_param(model,'SimulationCommand','Start') 

    The errors are logged in diary.txt.

    Again, introduce errors into the model.

    set_param('vdp/Mu','Gain','abc');

    Turn off logging.

    sldiagviewer.diary('off')

    Simulate the model.

    set_param(model,'SimulationCommand','Start')

    The errors will not be logged in diary.txt.

    Log simulation warnings and errors of a model in a specified text file using the UTF-8 encoding.

    Create log file mySimulationDiary.txt and set the character encoding as UTF-8.

    sldiagviewer.diary('mySimulationDiary.txt','UTF-8')

    Load the model vdp.

    model = 'vdp';
    load_system(model);

    Introduce errors in the model.

    set_param('vdp/Mu','Gain','xyz') 

    Simulate the model vdp.

    set_param(model,'SimulationCommand','Start') 

    The errors are logged in mySimulationDiary.txt.

    Input Arguments

    collapse all

    Name of log file, specified as a character vector or string scalar.

    Example: 'mySimulationDiary.txt','C:\MyLogs\logDiary.txt'

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

    Version History

    Introduced in R2014a