Execute a code section with a button
Mostrar comentarios más antiguos
Hello,
I have multiple code sections in my m-file separated with the double %% sign. Each code section outputs a plot. Now I want to create a GUI with multiple buttons for each plot. How can I program that a button executes a certain section?
5 comentarios
Adam
el 26 de Jul. de 2018
Just move the relevant sections of code into callback functions for the buttons, or better still, into standalone functions that are called from the callbacks and could also be called from anywhere else if desired too.
leonidas86
el 26 de Jul. de 2018
Adam
el 26 de Jul. de 2018
leonidas86
el 26 de Jul. de 2018
Adam
el 26 de Jul. de 2018
I'm afraid I know nothing about how Simulink works with workspaces as I have never used it so I'll have to leave that to someone else. /breaking data into functions and passing in only the variables the function itself needs is usually the best way to break down a large program though, or use OOP to create classes, but that is rather more advanced, though does solve problems of sharing data between multiple workspaces more neatly.
Respuestas (0)
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!