Main Content


Set language for S-function generated using S-Function Builder block

Since R2022a


    Simulink.SFunctionBuilder.setTargetLanguage(blk,lang) sets the target language for the S-function generated by the S-Function Builder block blk to the specified language lang.

    To specify build options such as whether the MEX file includes debugging information, use the Simulink.SFunctionBuilder.setBuildOptions function.

    Input Arguments

    collapse all

    S-Function Builder block, specified as a block handle or as a string or a character vector that defines the block path.


    • To get the block handle for a block in your model, use the getSimulinkBlockHandle function.

    • To get the block handle for the most recently selected or added block, use the gcbh function.

    S-function language, specified as one of these options:

    • 'inherited' — Language inherited from the Language (Simulink Coder) model configuration parameter

    • 'cpp' — C++

    • 'c' — C

    Data Types: char | string

    Version History

    Introduced in R2022a