MATLAB: How to plot Simulink signal values saved to the MATLAB workspace on an axes
getting startedguiMATLABsimulink
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.
Best Answer
I assume you run the Simulink model from the MATLAB GUI using thesim 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.
How are you starting the model running? If you are starting it from MATLAB using sim() then the variable would normally end up in the workspace of the function you ran sim() from.
save data to workspace as array by choosing the option from the scope giving required label u want let say sig .... then go to matlab workspace ad then try plot(sig )... hope it will work.......
Best Answer