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

1 view (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 1 Jan 2016
After you set(), call drawnow()

More Answers (0)

Categories

Find more on Function Creation in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!