Main Content

getSignal

Get code and calibration configuration from code mappings for block output signal

    Description

    example

    propertyValue = getSignal(myCodeMappingObj,portHandle,property) returns the value of a code mapping property or calibration property for the signal specified by a block output port handle. For example, use this function to return the name of the storage class or calibration access of a measurement 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 rtwdemo_configrpinterface, get the name of the storage class that is configured for the output signal of lookup table block Table1. 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.

    open_system('rtwdemo_configrpinterface');
    cm = coder.mapping.api.get('rtwdemo_configrpinterface');
    lut1_ports = get_param('rtwdemo_configrpinterface/Table1','PortHandles');
    lut1_outPort = lut1_ports.Outport;
    scTable1D = getSignal(cm,lut1_outPort,'StorageClass');

    From the model code mappings for model rtwdemo_configrpinterface, get the code identifiers that are configured for output signals of lookup table blocks Table1 and Table2. 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.

    open_system('rtwdemo_configrpinterface');
    cm = coder.mapping.api.get('rtwdemo_configrpinterface');
    lut1_ports = get_param('rtwdemo_configrpinterface/Table1','PortHandles');
    lut2_ports = get_param('rtwdemo_configrpinterface/Table2','PortHandles');
    lut1_outPort = lut1_ports.Outport;
    lut2_outPort = lut2_ports.Outport;
    setSignal(cm,lut1_outPort,'StorageClass','ExportedGlobal')
    setSignal(cm,lut2_outPort,'StorageClass','ExportedGlobal')
    idTable1 = getSignal(cm,lut1_outPort,'Identifier');
    idTable2 = getSignal(cm,lut2_outPort,'Identifier');

    From the model code mappings for model rtwdemo_configrpinterface, get the calibration properties configured for signal Signal_1.

    open_system('rtwdemo_configrpinterface');
    cm = coder.mapping.api.get('rtwdemo_configrpinterface');
    port_handles = get_param('rtwdemo_configrpinterface/Table1','PortHandles');
    Signal_1 = port_handles.Outport;
    prop_export = getSignal(cm,Signal_1,'Export');
    prop_bitmask = getSignal(cm,Signal_1,'BitMask');
    prop_calaccess = getSignal(cm,Signal_1,'CalibrationAccess');
    prop_compname = getSignal(cm,Signal_1,'CompuMethod');
    prop_dispid = getSignal(cm,Signal_1,'DisplayIdentifier');
    prop_format = getSignal(cm,Signal_1,'Format');
    

    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. For a storage class defined in the Embedded Coder Dictionary associated with the model, specify a property name or one of these property names.

    Information to ReturnProperty Name
    Name of storage classStorageClass
    Name of variable for signal data in the generated codeIdentifier
    Boolean value indicating whether to export the selected signal to a calibration file (a2l)Export
    Mask value in hexadecimal format to extract single bits from the signal in a calibration toolBitMask
    Enumeration value indicating the access of calibration. Calibration for a signal indicates that the signal can be calibrated. NoCalibration indicates that the signal can be read-only but cannot be calibrated. NoCalibration is the default value for the propertyCalibrationAccess
    Name of the conversion method used during the calibrationCompuMethod
    Optional display name of the signal for calibrationDisplayIdentifier
    Specifies the display format of the signal being measured in a calibration toolFormat

    Example: 'StorageClass'

    Example: 'CalibrationAccess'

    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