我有一个matlab Gui程序,它从串口获取输入数据并将它们绘制在图形中。 Gui有几个选项卡。在第二个选项卡中,我有一个popmenu,它允许我选择要绘制的数据。Matlab Gui更新阴谋与popmenu
回调函数
function popupCallback(src,~)
val = get(src,'Value');
% Second tab selected
if val == 2
try
while (get(xbee, 'BytesAvailable')~=0 && tenzo == true)
% reads until terminator
sentence = fscanf(xbee, '%s');
% Collect data to plot
getDataRoutine(sentence)
%Plot them
h1 = subplot(3,1,1,'Parent',hTabs(3));
plot(h1,index,gxdata,'r','LineWidth',2);
h2 = subplot(3,1,2,'Parent',hTabs(3));
plot(h2,index,gydata,'b','LineWidth',2);
h3 = subplot(3,1,3,'Parent',hTabs(3));
plot(h3,index,gzdata,'g','LineWidth',2);
end
end
end
当我选择在从串行字符串被分析popmenu第二个选项,数据被存储在变量,然后绘图。精细。
问题:只有当我点击在popmenu第二个选项
数据被绘制。我怎样才能获得“实时”绘制的数据?