Main Content


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

Since R2021a


    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, an exponentialDegradationModel, a reliabilitySurvivalModel, or a covariateSurvivalModel 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 a degradation RUL model at run time, use restoreState.

    Extended Capabilities

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

    Version History

    Introduced in R2021a