2015-10-05 49 views
1

我製作了一個simulink模型,並通過MATLAB GUI運行它,其中包含一個BLDC電機和一個控制其速度的PI控制器,現在問題是輸出apeed圖形在我停止時更新仿真我想GUI圖形的實時更新

% Update the string on the pushbutton 
set(handles.Startstopbutton,'String','Start Simulation') 

% Plot results from workspace after simulation 
x = evalin('base','Scope(:,1)'); 
y = evalin('base','Scope(:,2)'); 
pHandles = plot(x,y,'Parent',handles.axesplot); 

這就是我的圖形更新功能

回答

1

有幾種方法把它更新它在運行時的自我一個,因爲它在運行,包括MATLAB UI與Simulink模型進行交互

  1. 使用自定義S函數在每個時間步將數據傳遞給UI

  2. 使用Event Listeners設置爲隨着它們更改而監聽塊(信號)。

Use MATLAB GUI's with Simulink Models博客更詳細地討論了這些方法。