首页 > 其他分享 >matlab的gui图像处理操作界面,实现坐标轴重置界面

matlab的gui图像处理操作界面,实现坐标轴重置界面

时间:2023-01-10 16:00:30浏览次数:42  
标签:Ni set string text gui 操作界面 handles matlab Ns

1.首先建立gui界面,具体过程在这里不做赘述。

 

 

 

2.然后将坐标轴所要显示的曲线放到对应的位置。

按下开始按键,即可在相应位置显示曲线

 

 

 

function push_begin_button_Callback(hObject, eventdata, handles)%开始按键的回调函数
% hObject handle to push_begin_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

........(中间省略一些数据传递)

Ni_h = animatedline(handles.axes_Ni);
Ns_h = animatedline(handles.axes_Ns);

......

for k = 1:length(day)
addpoints(Ni_h,day(k),I_2(k));
str_R = sprintf('退出人数R: %d',R(k));
set(handles.text_R,'String',str_R);
drawnow
str_S2 = sprintf('健康者人数Ns: %d',S_2(k));
set(handles.text_Ns,'String',str_S2);

str_I2 = sprintf('病人人数Ni: %d',I_2(k));
set(handles.text_Ni,'String',str_I2);
addpoints(Ns_h,day(k),S_2(k));
drawnow

end

.......

 

 

3.按下清空界面,即可清楚全部数据,包括坐标轴曲线

function pushbutton_clear_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_clear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes_Ni); %指定需要清空的坐标轴
cla reset;
axes(handles.axes_Ns);
cla reset;

set(handles.edit_N,'string','');
set(handles.edit_S0,'string','');
set(handles.edit_I0,'string','');
set(handles.edit_lambda,'string','');
set(handles.edit_MIU,'string','');
set(handles.text_R,'string','退出人数R: ');
set(handles.text_Ns,'string','健康者人数Ns: ');
set(handles.text_Ni,'string','病人人数Ni: ');

 

 完成。

标签:Ni,set,string,text,gui,操作界面,handles,matlab,Ns
From: https://www.cnblogs.com/murongmurong/p/17040552.html

相关文章