【发布时间】:2014-09-03 07:56:49
【问题描述】:
我有一个 matlab Gui 程序,它从串行中获取输入数据并将它们绘制在图表中。 Gui 有几个选项卡。在第二个选项卡中,我有一个弹出菜单,允许我选择要绘制的数据。
回调函数
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
当我在弹出菜单中选择第二个选项时,分析来自串行的字符串,数据存储在变量中,然后绘制。很好。
问题:
只有当我点击弹出菜单中的第二个选项时才会绘制数据。如何获取“实时”绘制的数据?
【问题讨论】:
标签: matlab matlab-guide