Why is UserData preferred over guidata
显示 更早的评论
Storing app data in the UserData property of the main app figure is recommended over using guidata, because it can result in more readable code. For more information about storing and sharing app data, see Share Data Among Callbacks.
I do not understand why UserData results in more readable code. For example, extracting data from the UI in a callback is with guidata:
data = guidata(gobject);
and with UserData:
data = ancestor(gobject, "figure", "toplevel").UserData
What are the benefits of UserData over guidata and does it matter which one you use?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!