extracting variable from callback into base workspace
Show older comments
Hello,
I have a script that creates a dialog box, with all UIControl element declaration in a function - editdialogbox.
All callbacks are nested inside editdialogbox, so I have no problem passing/changing variables among callbacks.
In my dialog box, I have a pushbutton with a callback that:
- computes a variable laserSpot using data from edit boxes in the dialog box
- and then closes the dialog box.
In my main script, I have the code: waitfor(editdialogbox), so that the script only continues to run after the dialog box is closed. The problem is, the variable laserSpot is required in the later part of the code. How can I pass the variable into the base workspace?
I have read documentation on how to share data between workspaces, share data between callbacks, and it seems assignin() is probably the option to go. However, I have seen experts saying assignin() is not a good suggestion. What else can I do? and when is it actually alright to use assignin()?
Hope my problem is clear!
Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Historical Contests in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!