GUI: unused function warning
3 次查看(过去 30 天)
显示 更早的评论
Dear all, quick question on a GUI. Let's say you set up a button that plots a graph once pushed. In the editor you need a function like this:
function pushbutton8_Callback(~, ~, ~)
plot(someVariableElsewhereDefined)
Now, the editor will underline this function in red saying that it is unused.
Is this correct? Is there any way to do the same thing without the same "useless" function?
Thanks!
0 个评论
采纳的回答
Sean de Wolski
2013-11-7
编辑:Sean de Wolski
2013-11-7
Typically this happens if you delete the pushbutton or if there is another function with the same name (red underline - otherwise it's orange).
Sometimes, however, this happens on its own with GUIDE generated *.m files. I.e. the Code Analyzer is giving a false positive because it cannot see where the buttons are called from. If the code and pushbutton is working, you can ignore the Code Analyzer messages.
5 个评论
Walter Roberson
2017-1-24
You could change the Callback property to directly execute the action using an anonymous function or string. However if you do so then the change is likely to be overridden the first time that you use GUIDE to change the gui.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!