qc_get_model_extension qc_set_model_log navigation bar

Table of Contents

qc_get_model_log

Returns the filename of the log for the given model or configuration set.

Syntax

filename = qc_get_model_log             % Get the log for the active configuration of the current model
filename = qc_get_model_log(model)      % Get the log for the active configuration of the given model
filename = qc_get_model_log(config_set) % Get the log for the given configuration
    

Description

Returns the filename of the log for the given model or configuration set. If there is no log configured then it returns the empty string. The log is set via the MEX-file arguments and is used to log messages from the Simulink diagram, including errors. The qc_get_model_log function returns the filename after substituting for format specifiers. The following format specifiers are recognized and replaced 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. %{date} or %{time}

The model name format specifier, %m is clearly useful for the log filename because it indicates the model with which the log is associated. Likewise, the target type format specifier, %t is useful for generating a log filename that includes the type of the target.

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 also useful in many instances. For example, the date and/or time may be embedded in the filename of the log. 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.

The qc_get_model_log function coerces the result after substitutions to be a valid filename. For example, the colon in the time string returned by %{time} is replaced with hyphens, since colons are not valid in a filename except after the drive letter.

Parameters

model

A string containing the name of a model. The model is used to determine the active configuration for substitutions involving the model URI or components of it.

config_set

A Simulink.ConfigSet configuration set used to find the substitution values (see getConfigSet). The configuration set is used for substitutions involving the model URI or components of it.

Outputs

filename

The log filename after substituting for the format specifiers.

Examples

filename = qc_get_model_log('q_a_lpbk'); % Get the filename of the log for the 'q_a_lpbk' model
    

See Also

 

navigation bar