qc_get_model_log qc_get_model_uri navigation bar

Table of Contents

qc_set_model_log

Sets the filename of the log associated with a model in the MEX-file arguments.

Syntax

qc_set_model_log(model, filename)       % Sets log filename of specified model
qc_set_model_log(config_set, filename)  % Sets log filename of specified configuration set
qc_set_model_log(filename)              % Sets log filename of current model
    

Description

Sets the filename of the log associated with a model as part of QUARC's model logging capabilities to filename. If no model is specified, then the current model is used. When the filename is not an empty string, QUARC appends log messages to the given file while the model is running. The log file is also used by the Log Message block, which adds user-defined messages to the log.

The following format specifiers are replaced in the log filename with the appropriate values:

Format Specifier

Description

%d

the current Matlab directory in quotes e.g. "C:\Documents and Settings\myname\My Documents\MATLAB"

%D

the current Matlab directory using short filenames (PC) or escaped spaces (UNIX) e.g. "C:\Docume~1\myname\MyDocu~1\MATLAB" (requires Simulink Coder)

%m

the model name e.g. mymodel

%q

replaced with a double quote (since MATLAB does not accept double quote characters)

%t

the target type for the given model or configuration set (e.g. windows, qnx_x86, etc.)

%(var)

the value of environment variable 'var' (on the host!) e.g. %(PATH)

%{expr}

the value of a MATLAB expression e.g. %{x + 1}

The current MATLAB directory specifiers, %d or %D, may be employed to refer to the current working directory, although paths are generally relative to the working directory anyways.

The model name specifier, '%m', is particularly useful in forming the name of the log file since it is typically derived from the model name.

The environment variable specifier is convenient for accessing the user's home directory, for example, by using the format specifier %(HOME).

The ability to substitute a MATLAB expression is useful in many instances. Some particularly useful expressions are:

Expression

Description

%{date}

the current date. See date.

%{time}

the current time. See time.

%{datestr(now,format)}

the date or time in a particular format. See datestr for valid formats.

%{instance(3)}

an instance count, incremented every time the substitution is performed. See instance.

Note that this function only changes the log filename for the given model. It does not modify the default log filename used for all models. To change the default log filename, use the qc_set_default_model_log function.

Parameters

model

A string containing the name of a model. The model is used to determine the active configuration in which to set the log filename.

config_set

A Simulink.ConfigSet configuration set (see getConfigSet). The configuration set contains the log filename and is used for format specifier substitutions.

filename

A string containing the log filename to associate with the model.

Outputs

This function has no outputs.

Examples

qc_set_model_log('q_a_lpbk', '%{date}/%m-{time}.log'); % Sets log filename to '%{date}/%m-{time}.log'.
    

See Also

 

navigation bar