Main Content

M-function

Description

Specify rule for naming identifiers in generated code.

Category:Code Generation > Identifiers

Settings

Default:''

Enter the name of a MATLAB®language file that contains the naming rule to be applied to signal, parameter, or#defineparameter 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_signalto a signal data object name.

function revisedName = append_text(name, object) % APPEND_TEXT: Returns an identifier for generated % code by appending text to a 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 = '_signal'; revisedName = [name,text];

Tip

The MATLAB language file must be in the MATLAB path.

Dependencies

This parameter:

  • Appears only for ERT-based targets.

  • Requires Embedded Coder®when generating code.

  • Is enabled bySignal naming.

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

Command-Line Information

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

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

Related Topics