Main Content

getSignal

Get code configuration from code mappings for block output signal

    Description

    example

    propertyValue = getSignal(myCodeMappingObj,portHandle,property) returns the value of a code mapping property for the signal specified by a block output port handle. Use this function to return the name of the storage class or the value of a storage class property configured for a signal.

    This function does not apply to signals that originate from root-level Inport blocks. For signals that originate from root-level Inport blocks, see getInport.

    Examples

    collapse all

    From the model code mappings for model myConfigModel, get the name of the storage class that is configured for the output signal of lookup table block Table1D. After creating the object cm by calling function coder.mapping.api.get, get the handle to the output signals for the lookup table block. Get the storage class configured for the output port by calling getSignal.

    cm = coder.mapping.api.get('myConfigModel');
    lut1D_ports = get_param('myConfigModel/Table1D','PortHandles');
    lut1D_outPort = lut1D_ports.Outport;
    scTable1D = getSignal(cm,lut1D_outPort,'StorageClass');
    

    From the model code mappings for model myConfigModel, get the code identifiers that are configured for output signals of lookup table blocks Table1D and Table2D. After creating the object cm by calling function coder.mapping.api.get, get the handles to the output ports for the lookup table blocks. Get the code identifiers configured for the output ports by calling getSignal.

    cm = coder.mapping.api.get('myConfigModel');
    lut1D_ports = get_param('myConfigModel/Table1D','PortHandles');
    lut2D_ports = get_param('myConfigModel/Table2D','PortHandles');
    lut1D_outPort = lut1D_ports.Outport;
    lut2D_outPort = lut2D_ports.Outport;
    idTable1D = getSignal(cm,lut1D_outPort,'Identifier');
    idTable2D = getSignal(cm,lut3D_outPort,'Identifier');
    

    Input Arguments

    collapse all

    Code mapping object (model code mappings) returned by a call to function coder.mapping.api.get.

    Example: myCM

    Block output signals for which to return signal code mapping information.

    Example: portHandle

    Data Types: port_handle

    Code mapping property for which to return a value. Specify one of these property names.

    Information to ReturnProperty Name
    Name of storage classStorageClass
    Name of variable for signal data in the generated codeIdentifier

    Example: 'StorageClass'

    Output Arguments

    collapse all

    Name of the storage class or value of the specified storage class property configured for the specified signal.

    Data Types: char

    Introduced in R2020b