How to automatically update MATLAB GUI axes handles?
8 次查看(过去 30 天)
显示 更早的评论
Hello,
I created an application with MATLAB GUI that has several sections, each section has multiple push buttons, and at the end of each there is a figure that needs to be updated.
My question is: how can I pass the output of a callback function to the figure handle so that it gets updated as soon as the output is produced?
The figure is a scattered plot of a point cloud data, what I want is for example when I load in a file, it automatically shows the raw data (say OUTPUT = RAW), then when I process the data it should automatically update the figure with (OUTPUT = Processed). Without writing a few lines again to pass the Processed to figure handle.
Any help is much appreciated.
0 个评论
采纳的回答
Steven Lord
2020-2-20
Callback functions don't have outputs, at least not how they are called by the usual workflow of a UI in MATLAB.
I'd probably write a function that your pushbutton callbacks can use to set the status message appropriately, something like:
function setStatusMessage(f, newmessage)
f.statusWindow.String = newmessage;
end
where statusWindow is the component in the figure that contains the status message.
That's also pretty self-documenting.
function gridSmoothedData_Callback(...)
% Do some processing on the data
setStatusMessage(f, "Processed");
% Maybe call the next step in the process
updateSmoothedDataVisualization(...);
end
Without even seeing what the function accepts can you tell the purpose of this callback, what the state of the process is when this function finishes, and what the next step is?
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!