Main Content

sldiagviewer.diary

Log diagnostic messages and build information in file

    Description

    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.

    example

    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 DiagnosticDemo.

    model = "DiagnosticDemo";
    load_system(model);

    Introduce errors into the model.

    set_param("DiagnosticDemo/Gain","Gain","xyz")

    Simulate the model DiagnosticDemo.

    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 DiagnosticDemo.

    model = "DiagnosticDemo";
    load_system(model);

    Introduce errors into the model.

    set_param("DiagnosticDemo/Gain","Gain","xyz")

    Simulate the model DiagnosticDemo.

    set_param(model,"SimulationCommand","Start") 

    The errors are logged in mySimulationDiary.txt.

    Create a log by file using sldiagviewer.diary and toggle the logging state.

    Create the log file diary.txt and turn on logging.

    sldiagviewer.diary

    Load the model DiagnosticDemo.

    model = "DiagnosticDemo";
    open_system(model);

    Introduce errors into the model.

    set_param("DiagnosticDemo/Gain","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("DiagnosticDemo/Gain","Gain","abc");

    Turn off logging.

    sldiagviewer.diary("off")

    Simulate the model.

    set_param(model,"SimulationCommand","Start")

    The errors are not 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 DiagnosticDemo.

    model = "DiagnosticDemo";
    load_system(model);

    Introduce errors in the model.

    set_param("DiagnosticDemo/Gain","Gain","xyz") 

    Simulate the model DiagnosticDemo.

    set_param(model,"SimulationCommand","Start") 

    The errors are logged in mySimulationDiary.txt.

    Input Arguments

    collapse all

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

    Example: "mySimulationDiary.txt"

    Example: "C:/MyLogs/logDiary.txt"

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

    Version History

    Introduced in R2014a