Main Content

Simulink.SubsystemReference.setCodegenPath

R2026b

Set code generation folder of subsystem file

Since R2026b

    Description

    Simulink.SubsystemReference.setCodegenPath(ssFile,codeGenPath) sets the folder specified by codeGenPath as the code generation folder of the subsystem file ssFile. If the specified folder does not exist, Simulink® creates the folder.

    example

    Examples

    collapse all

    Set a code generation folder for the subsystem file slexReusableSS.

    Open the subsystem file slexReusableSS in the Validate Subsystem Reference Use in Model and Generate Reusable Code example.

    openExample("subsystem_reference/DefineSSRefInterfaceUsingTestHarnessGenerateCodeExample",...
          SupportingFile="slexReusableSS");

    Specify a relative path to set the code generation folder.

    Simulink.SubsystemReference.setCodegenPath("slexReusableSS","codegen/output");

    Input Arguments

    collapse all

    Path or handle of the subsystem file, specified as a string scalar or character vector.

    Data Types: string | char

    Absolute or relative path to the folder to be set as the code generation folder, specified as a string scalar or character vector.

    Data Types: string | char

    Version History

    Introduced in R2026b