- One approach is to initiate the simulation of your model by using the “sim('your_model_name’)” command when the button is clicked. You can then save the outputs in a file or workspace and retrieve them to populate the edit field or label accordingly.
- Another option is to incorporate an event listener into your Simulink block using the "add_exec_event_listener(blk, event, listener)" function. This listener will be triggered in your app whenever the block's computation takes place, allowing you to access the values from the block within the listener.
How to display Counter Value from Simulink in App Designer?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I want to display countdown and trial block number in this App when I turn the countdown switch to on.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1008135/image.png)
This has been achieved very easily in GUI using GUIDE. ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1008140/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1008140/image.png)
The timer and trial block number come from simulink ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1008145/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1008145/image.png)
In GUIDE, you can just use the text figure setting. But in App, that is not an option in the simulink block.
The way I am getting around it now is just opening up two separate figures for the Trial Block and Countdown. ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1008150/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1008150/image.png)
But I would like to have it all contained in the App. How can I just display the counts in the edit fields or even in a label on the App? Thank you!
0 comentarios
Respuestas (1)
aditi bagora
el 5 de Oct. de 2023
Hi Alexandra,
I understand that you're looking to display the values of the "counter" and "Trial" blocks generated from your Simulink model in the edit field or label of your App. There are a few methods you can use to accomplish this.
The following answer from the community can be helpful.
0 comentarios
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!