Plot from workspace data in gui

조회 수: 5 (최근 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 CenterFile Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by