Table of Contents
qc_get_model_log
Returns the filename of the log for the given model or configuration set.
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
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
.
MATLAB Command Line Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window: doc date |
%{time} |
the current time. See time. |
%{datestr(now,format)} |
the date or time in a particular format. See datestr
for valid formats.
MATLAB Command Line Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window: doc datestr |
%{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.
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
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc getConfigSetfilename
The log filename after substituting for the format specifiers.
filename = qc_get_model_log('q_a_lpbk'); % Get the filename of the log for the 'q_a_lpbk' model
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.