How can I update Text box dynamically(in regular intervals) in Matlab GUI?

2 次查看(过去 30 天)
Below is the callback function for the pushbutton run in the GUI: I want to run a while loop which continuously updates the value in the edit text box of the GUI with value from the simulink model but as soon as I press the RUN button in the GUI, it goes into infinite while loop and the simulation does not run.
function pushbutton_run_Callback(hObject, eventdata, handles)
handles=guidata(hObject);
flag=get(hObject,'string');
if strcmp(flag,'RUN')==1
set_param(handles.modelname,'SimulationCommand','Start');
set(hObject,'string','STOP');
while(strcmp(get(handles.pushbutton_run,'string'),'STOP'))
%some code for updating text box
end
else
set_param(handles.modelname,'SimulationCommand','Stop');
set(hObject,'string','RUN');
end
guidata(hObject,handles);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by