Using block variant source in mask
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, I am not able to make it read the value of the variable "test" chosen in the mask. If anyone can help me please.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1455527/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1455532/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1455537/image.png)
0 Commenti
Risposte (1)
Dinesh
il 3 Lug 2024
Hi Rafaela.
I think that you have defined the variant control expression using "Simulink.VariantExpression" which is currently not supported for mask workspace variables. Please refer to the following highlighted documentation link: https://www.mathworks.com/help/simulink/ug/approaches-to-control-active-variant-choice-of-a-variant-block.html#:~:text=Do%20not%20support%20using%20Simulink.VariantExpression%20objects%20or%20Simulink.Parameter%20as%20variant%20control%20variables.
Instead of using "Simulink.VariantExpression" objects, you could define the variable "test" directly in MATLAB workspace and modify the "Variant Source" dialog to have "test==1" and "test==2" under "Variant control expression" for Port 1 and 2 respectively. Along with this, you can modify the workspace parameter to have values "1" and "2" in the dropdown. I tested this approach and it works perfectly fine and the variant choice is chosen during compile depending on the value specified in the mask.
I hope this helps.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!