Info

This question is closed. Reopen it to edit or answer.

GUI with guide, statements around the functions

1 view (last 30 days)
Emma Sandström
Emma Sandström on 5 May 2017
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello, Im building a pretty large GUI with guide and im stuck behind that i cannot use statements around the accual callback functions. Is this something that can be done at all?
I saw something about creating an own function and re-lable the functions for the Components in the GUI. it is possible to make the entire GUI behind a functions with multiple functions behind it?
Another question is how i can use the variables from the workspace back to my GUI again, im sending some to the WS to be able to use them in a diffrent background script, and then send them back to a plot inside the GUI.
Thanks
  1 Comment
Adam
Adam on 5 May 2017
Edited: Adam on 5 May 2017
What do you mean by 'statements around the actual callback functions'?
Callbacks are, by their nature, triggered by the UI components for which they are callbacks. That is their sole purpose.
As far as workspace goes, use the GUI's own workspace(s). Each callback has its own workspace and can call functions just like you can from the base workspace or a script. It doesn't make any sense to have variables dumped to the base workspace from a GUI normally because if the person using the GUI has access to the workspace they might as well just create the variables there directly without bothering with the GUI!

Answers (1)

Santhana Raj
Santhana Raj on 5 May 2017
U can use statements 'around' callback functions. You have to be more clear on this.
Since you are new to GUIDE, I would advise you not to do that. But instead call these self created functions from the callback functions
Instead of taking data to WS and then back in, Use the structure "handles." This is passed on to all functions and if used properly, work like a charm.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!