我有一個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第二個選項
數據被繪製。我怎樣才能獲得「實時」繪製的數據?