How to automatically update MATLAB GUI axes handles?

9 vues (au cours des 30 derniers jours)
Feri
Feri le 20 Fév 2020
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.

Réponse acceptée

Steven Lord
Steven Lord le 20 Fév 2020
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?

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by