Main Content

getClassName

Get class name of model

Since R2021a

Description

example

name = getClassName(slMap) returns the class name of the model.

Examples

collapse all

Open the model. To access the mapping information associated with the model, slMap, use the autosar.api.getSimulinkMapping function.

%% Open an adaptive AUTOSAR model
hModel = 'autosar_LaneGuidance';
openExample(hModel);

%% Access the mapping information
slMap = autosar.api.getSimulinkMapping(hModel);

To access the class name of the model, use the getClassName function. If you did not specify a class name for the model, the getClassName function returns an empty character vector and the class name in the generated code uses the model name as the default class name.

name = getClassName(slMap)
name =

    0x0 empty char array

Specify a class name for the model by using the setClassName function.

setClassName(slMap, 'myClassName');

The getClassName function now returns the specified class name.

name = getClassName(slMap)
name =

    'myClassName'

Input Arguments

collapse all

Simulink to AUTOSAR mapping information for a model, previously returned by slMap = autosar.api.getSimulinkMapping(model). model is a handle, character vector, or string scalar representing the model name.

Example: slMap

Output Arguments

collapse all

Class name of model returned as a character vector. If you do not specify a class name, the class name in the generated code uses the model name as the default class name.

Version History

Introduced in R2021a