- 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 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Shivam Lahoti
2024년 2월 14일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Target Computer Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!