Main Content

M-function

Specify rule for naming identifiers in generated code

Model Configuration Pane: Code Generation / Identifiers

Description

Specify rule for naming identifiers in generated code.

Dependencies

This parameter:

  • Appears only for ERT-based targets.

  • Requires Embedded Coder® when generating code.

  • Is enabled by #define naming.

  • Must be the same for top-level and referenced models.

Settings

'' (default) | string

Enter the name of a MATLAB® language file that contains the naming rule to be applied to signal, parameter, or #define parameter identifiers in generated code. Examples of rules you might program in such a MATLAB function include:

  • Remove underscore characters from signal names.

  • Add an underscore before uppercase characters in parameter names.

  • Make identifiers uppercase in generated code.

For example, the following function returns an identifier name by appending the text _define to a data object name.

function revisedName = append_text(name, object)
% APPEND_TEXT: Returns an identifier for generated
% code by appending text to a #define data object name.
%
% Input arguments:
% name: data object name as spelled in model
% object: target data object
%
% Output arguments:
% revisedName: altered identifier returned for use in
% generated code.
%
%
text = '_define';

revisedName = [name,text];

Tips

The MATLAB language file must be in the MATLAB path.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: DefineNamingFcn
Type: character vector
Value: MATLAB language file
Default: ''

Version History

Introduced before R2006a