Plot from workspace data in gui

5 visualizzazioni (ultimi 30 giorni)
Loong
Loong il 2 Mag 2012
Risposto: siyaram bhatt il 5 Gen 2017
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....

Risposte (1)

siyaram bhatt
siyaram bhatt il 5 Gen 2017
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

Categorie

Scopri di più su Interactive Model Editing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by