Main Content


Load and reconstruct RUL model from file for use in code generation


    mdl = loadRULModelForCoder(filename) reconstructs an RUL model object from properties stored in filname, which is a file created using saveRULModelForCoder. Use loadRULModelForCoder in an entry-point function for code generation to reconstruct the model at compile time. See Generate Code for Predicting Remaining Useful Life for more information.

    Input Arguments

    collapse all

    File containing saved model, specified as a character vector or string. filename is a file created using saveRULModelForCoder. You can specify a full or relative path in filename.

    Output Arguments

    collapse all

    RUL model loaded from file, returned as a linearDegradationModel or exponentialDegradationModel object. The RUL model has the same type and property values as the model used to create filename.


    • loadRULModelForCoder loads the model at compile time, not at run time. Therefore, any changes you make to the MAT file after compiling are not available at run time. To update the state of the model at run time, use restoreState.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Introduced in R2021a