Plot from workspace data in gui

3 ビュー (過去 30 日間)
Loong
Loong 2012 年 5 月 2 日
回答済み: siyaram bhatt 2017 年 1 月 5 日
I would like to get the results from my simulink model and plot in the GUI, but I facing problem to getting data from workspace. In my simulink model, i have save my simulation data to base workspace using "to workspace" block. I just want a simple gui that i press on push button, data that i save to base workspace can be plot out.
I have tried below codes:
1) plot(x,y); (error show undefined variables, but x and y already save in the workspace)
2)x=evalin('base','x'); y=evalin('base','y'); plot(x,y); (error show it not enough input argument )
But still cannot. I think it should very simple.
Please help....I am new in matlab....

回答 (1 件)

siyaram bhatt
siyaram bhatt 2017 年 1 月 5 日
You can use scope block in Simulink for Workspace in Matlab. In scope under logging you can choose "log to workspace" option. Take this option for GUI.
Then write in Matlab script:
axes(handles.plot1); % (plot1 is the name of axes)
plot(Scopedata.time, Scopedata.signals.values);
ing

カテゴリ

Help Center および File ExchangeInteractive Model Editing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by