Main Content

addArgument

Add argument to RTW.CImplementation object

Since R2024a

    Description

    addArgument(implementation,arg) adds the argument to the RTW.CImplementation object that represents the implementation function specification implementation.

    example

    Examples

    collapse all

    Add an input argument to the specification for an implementation function. For this example, the implementation function replaces the initialize function of a Discrete FIR Filter block.

    Create a block replacement entry for the Discrete FIR Filter block.

    hLib = RTW.TflTable;
    
    entry = RTW.TflBlockEntry;
    entry.Key = 'DiscreteFir';

    Create the RTW.CImplementation object that represents the implementation function. Specify the name and header file for the function.

    impl = RTW.CImplementation;
    impl.Name = 'arm_fir_init';
    impl.HeaderFile = 'arm_math.h';
    

    Add an input argument to the implementation function object.

    arg = getTflArgFromString(hLib, 'u1', 'uint16');
    addArgument(impl, arg);

    Add the implementation function to the block replacement entry as the replacement initialization function.

    addImplementation(entry, 'initialize', impl);

    Input Arguments

    collapse all

    Implementation function, specified as an RTW.CImplementation object.

    Implementation function argument, specified as a handle such as the argument handle returned by the function getTflArgFromString.

    Example: getTflArgFromString('u1','uint16')

    Version History

    Introduced in R2024a