- Pre-allocate the Parameter: Define the Simulink.Parameter with the maximum size you expect to use.
- Use a Subset: Only use the subset of the parameter that you need for a particular operation.
- Control with Additional Parameters: Use additional parameters to indicate which subset of the array is currently active.
Change parameter dimensions with setparam method
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I’m building a Simulink RT app with App Designer and have the following issue. When I build the model, it compiles correctly and I assume that the target computer (speedgoat) compiles the data dictionary with all the parameters to run the model. The issue is I would want to update a Simulink.Parameter, which is an array, to a new value with different dimensions. The method to set new values on the target is “setparam()” but it seems to only access its value, not the rest of the fields (like dimension). How can I achieve what I’m looking for? Unfortunately for privacy reasons I cant share my model but I think the question is clear.
0 commentaires
Réponses (1)
Shivam Lahoti
le 14 Fév 2024
Hi Enzo,
From what I understand, you wish to change both the values and the dimensions of a parameter in your real-time application (RT-app). However, for real-time applications or when using real-time hardware like Speedgoat, the dimensions of parameters must be fixed at the time of compilation and cannot be altered during execution. If you need to adjust the dimensions for a real-time application, the typical process would involve modifying the model to accommodate the new dimensions and then recompiling and redeploying the application.
Nevertheless, there is a potential workaround that involves pre-allocating the parameter to its maximum size, if that approach is suitable for your situation. Please follow these steps:
For example, if you occasionally require a 3-element array and at other times a 5-element array, you should define the parameter as a 5-element array. Then, use additional parameters to indicate the current number of elements being utilized.
Regards,
Shivam.
0 commentaires
Voir également
Catégories
En savoir plus sur Target Computer Setup dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!