How to update GUI with interims results of an algorithm in real time while the algorithm is still running??!

1 visualizzazione (ultimi 30 giorni)
Hi mathworks community,
i have a quite simple question that i dont know how to deal with yet.
I implemented a GUI with GUIDE and run an Algorithm "heuristic.m" by pushing a PUSHBUTTON! This Algorithm produces better and better results as it converges to a better solution. I would like the user to always see the best so far solution produced by the algorithm on the GUI surface!
I tried doing so by putting the following lines in the algorithms code.
hMainGui = findobj('Tag','gui_surface') % find tag for GUI-Surface
handles=guidata(hMainGui) % Obtain handles for GUI-components
set(handles.solution_value,'string',solution_value_best_so_far) % Update of the GUI edit-textbox
Unfortunately i see that this code doesnt work while the algorithm is running!! But as soon as i stop the algorithm the corresponding values are written in the edit-textbox... Is there a possibility of getting a continous update during the runtime of the algorithm? What did i do wrong?
I am soo glad for your help!
Best regards, John

Risposta accettata

Walter Roberson
Walter Roberson il 1 Gen 2016
After you set(), call drawnow()

Più risposte (0)

Categorie

Scopri di più su Function Creation in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by