qc_set_model_arguments qc_set_model_copy navigation bar

Table of Contents

qc_get_model_copy

Returns the filename to which to copy the given model for logging purposes.

Syntax

filename = qc_get_model_copy             % Get the copy filename for the active configuration of the current model
filename = qc_get_model_copy(model)      % Get the copy filename for the active configuration of the given model
filename = qc_get_model_copy(config_set) % Get the copy filename for the given configuration
    

Description

Returns the filename to which to copy the model for logging purposes. If there is no model copy configured then it returns the empty string. The filename to which to copy the model may be set via the MEX-file arguments or using the qc_set_model_copy command. The qc_get_model_copy 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 copy filename because it indicates the model from which the copy was made. Likewise, the target type format specifier, %t is useful for generating a copy 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 model copy. 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

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

doc datestr
for valid formats.

%{instance(3)}

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

The qc_get_model_copy function coerces the result after substitutions to be a valid model filename. For example, the colon in the time string returned by %{time} is replaced with underscores, since colons are not valid in a filename except after the drive letter. It also removes leading non-alphabetic characters, since model names must be valid MATLAB identifiers.

If the output is an empty string then no copy of the model is made when the model is started.

Parameters

model

A string containing the name of a model. The model is used to determine the active configuration for extracting the copy filename and for format specifier substitutions.

config_set

A Simulink.ConfigSet configuration set (see

getConfigSet

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

doc getConfigSet
). The configuration set contains the copy filename and is used for format specifier substitutions.

Outputs

filename

The filename to which to copy the model, after substituting for the format specifiers.

Examples

filename = qc_get_model_copy('q_a_lpbk'); % Get the filename of the copy for the 'q_a_lpbk' model
    

See Also

 

navigation bar