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

2 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by