Main Content

Save and Reload Parameters by Using the MATLAB Language

After you load a real-time application that has parameter values, you can save those values to a parameter set file on the Speedgoat® target computer. You can then later reload these parameter values to the same real-time application. To ease the process of tuning parameters, use the ParameterSet object workflow. For example code that demonstrates this workflow, see the ParameterSet object.

Note

The parameter set file lets you preserve parameter values outside of the real-time application and model. To apply parameter values from the parameter set file, load the parameter set into the real-time application after you load the application. This action appears in the Edit parameters loop of the workflow. (See lower left quadrant of figure.)

With ParameterSet objects, you can:

  • Export the values from the parameter set to the model by using exportToModel function.

  • Save the ParameterSet object as a MAT file and share this MAT file with other developers.

  • Add the parameter set into the real-time application MLDATX file and set the parameter set as the startup parameter set by using the addParamSet and updateStartupParameterSet functions.

  • Edit or tune parameter values in parameter set by using the parameter set function or the parameter explorer function.

You can save parameters from your real-time application while the real-time application is running or between runs. You can save and restore parameters in your real-time application without rebuilding the Simulink® model. Load parameters to the same real-time application from which you saved the parameter file. If you attempt to load a parameter file to a different real-time application or to a real-time application that has changed since the parameter set was created, the load issues an error.

You can use the syncWithApp function to synchronize an out-of-sync ParameterSet object with the specified real-time application. This function synchronizes the parameter name-value pairs and synchronizes the model checksum saved in the ParameterSet object with the real-time application. After synchronizing, the parameter set that you saved from the original application can be loaded into the most updated application on the target computer.

You save and restore parameters by using the target object methods saveParamSet and loadParamSet.

Requirements:

  • Create a Target object named tg connected to the target computer.

  • Load a real-time application on the target computer.

  • There are parameters to save from the application.

See Also

| | | | | | | | | | | | | | | | | |

Topics