Main Content

Simulink.SFunctionBuilder.getUserCode

Get code for method of S-function generated using S-Function Builder block

Since R2022a

    Description

    userCode = Simulink.SFunctionBuilder.getUserCode(blk,methodType) returns the user code userCode specified for the method indicated by methodType of the S-Function Builder block blk.

    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.

    Tips

    • 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 method code to get, specified as one of these options:

    • 'includes' — Return S-function include statements.

    • 'externs' — Return global variable declarations for S-function.

    • 'start' — Return code defined for start method of S-function.

    • 'output' — Return code defined for output method.

    • 'update' — Return code defined for update method.

    • 'derivatives' — Return code defined for derivatives method.

    • 'terminate' — Return code defined for terminate method.

    Data Types: char

    Output Arguments

    collapse all

    Code for specified method of S-function, returned as a character vector.

    Version History

    Introduced in R2022a