qc_get_model_copy qc_get_model_extension navigation bar

Table of Contents

qc_set_model_copy

Sets the filename to which to copy the model in the MEX-file arguments.

Syntax

qc_set_model_copy(model, filename)       % Sets copy filename of specified model
qc_set_model_copy(config_set, filename)  % Sets copy filename of specified configuration set
qc_set_model_copy(filename)              % Sets copy filename of current model
    

Description

Sets the filename to which to copy the 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 copies the model to the given file every time the model is started.

The following format specifiers are replaced in the copy 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 file to which to copy the model 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 filename for the given model. It does not modify the default copy filename used for all models. To change the default copy filename, use the qc_set_default_model_copy 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 copy filename.

config_set

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

filename

A string containing the new filename to which to copy the model.

Outputs

This function has no outputs.

Examples

qc_set_model_copy('q_a_lpbk', '%{date}/%m_{time}.mdl'); % Sets copy filename to '%{date}/%m_{time}.mdl'.
    

See Also

 

navigation bar