How do I plot Simulink signal values saved to the MATLAB workspace on an axes?
426 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
andoni
il 31 Mag 2011
Commentato: Pallavi Chaturvedi
il 21 Lug 2022
I have to plot a signals in a MATLAB gui.
With Simulink I make a simulation and I save the signal in the workspace. I want to plot that signal in a gui axes but I dont know what I have to do.
1 Commento
Risposta accettata
Arnaud Miege
il 31 Mag 2011
I assume you run the Simulink model from the MATLAB GUI using the sim command. The data from your Scope will end up in the GUI (caller) workspace rather than the base workspace. So you should be able to plot it using something like:
plot(ScopeData.time, ScopeData.signals.values)
You may need to specify the handle of the axis on which to plot the data.
HTH,
Arnaud
4 Commenti
Più risposte (5)
Walter Roberson
il 31 Mag 2011
Are you using a "To Workspace" block? If so then when you look at the variable, what class() and size() is it? And what kind of plot are you thinking of?
6 Commenti
Walter Roberson
il 31 Mag 2011
Though before that you might need to add
ScopeData = evalin('base', ScopeData);
in order to import the data from the base workspace in to the workspace of the current function.
Nuno Agualusa
il 28 Gen 2012
Hi,
I'm facing the same problem, but with a small diference. I'm running the simulink from GUI, but when the simulation finish doesn't apear a variable 'simout' in my base workspace. So i can´t plot the result on axes. I'm using a variable block in simulink, to get all the data to worspace. The only way that i found to get a variable in base workspace, is to run the simulation manualy in simulink.
what can i do to solve this situation?
Thank you very much.
Nuno
2 Commenti
Kaustubha Govind
il 30 Gen 2012
How are you running the SIM command? You might want to set 'DstWorkspace' to 'current' to make sure that Simulink uses your GUI function workspace as the destination workspace.
Nuno Agualusa
il 30 Gen 2012
yes, the running command that i used is:
[tempo_simulacao]=evalin('base','tempo_sim');
[timeVector,stateVector,outputVector]=sim('Sistema_s_Atraso_SelfTuning',tempo_simulacao);
The problem is when a simulation ends i can't plot in my GUI axes the result of the simulation..and this action has to be peformed only trought out GUI.
yati j
il 9 Ott 2016
Modificato: Walter Roberson
il 9 Ott 2016
Hello, Could u suggest me any tutorial or any solution to this
- i have my motor dc to run
- when the dc motor run/rotate, maybe a graph pop-up which is read my motor speed or relevant to the rotation
- i dont know the connection btween component
- i dont know how to draw the simulink
i've read and watched a lot of tutorial.
Thank You.
1 Commento
tran xuanminh
il 26 Lug 2017
Modificato: Walter Roberson
il 26 Lug 2017
>>plot(ScopeData.time,ScopeData.signals.values);
>>grid on;
??? >>plot(ScopeData.time,ScopeData.signals.values);
|
Error: Unexpected MATLAB operator.
please coment my erro, thanks
2 Commenti
Walter Roberson
il 26 Lug 2017
Change your code to
plot(ScopeData.time,ScopeData.signals.values);
grid on;
Pallavi Chaturvedi
il 21 Lug 2022
how to use plot when each signal value has 3 dimesions ,plot style [1,1,1].
Vedere anche
Categorie
Scopri di più su Simulink Functions 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!