extracting variable from callback into base workspace
显示 更早的评论
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!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Historical Contests 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!