You are on page 1of 5

Use a To Workspace block to log your signal.

Set its Save


format to Structure with time and name it as ScopeData. Then,
when the simulation is over, type the command:
time=ScopeData.time;
data=ScopeData.signals.values(:,1);
plot(time,data)

plot(simout.time,simout.signals.values)

%1. save your simulink model and your m-file in the same directory
%2. inside the simunlink model rename your scope you want to plot as
mySimScope
%3. in your m-file include the following commands
sim('mySimulinkModel')
open_system('mySimulinkModel/mySimScope') %opens the scope
ylabel('Y-axis')
xlabel('X-axis')
grid on
grid minor

How do I manipulate or print a scope plot from Simulink (Matlab)

The menu in some Matlab/Simulink plots (scopes) or figures maybe


hidden. Answer taken from the Mathworks site. For more information
see Solution ID: 1-18DQB which states:

The ability to interact with Scope figure properities is not available


because the handle of the Scope figure is not turned on. To turn the
handle of your Scope figure on, and show the menus, type the following
at the MATLAB command prompt (after opening the Scope figure):
shh = get(0,'ShowHiddenHandles');
set(0,'ShowHiddenHandles','On')
set(gcf,'menubar','figure')
set(gcf,'CloseRequestFcn','closereq')
set(gcf,'DefaultLineClipping','Off')
set(0,'ShowHiddenHandles',shh)

you can save with different formats: Timeseries, Structure with time,
Structure, Array. Then, when you run the simulink, it will save the
variable in the worksapce as a structure. Then you can use the variable
to plot the data inside. check this example : consider you saved using
Structure with time you can get data like this:
t = simout.time
x = simout.signals.values

and you can plot the data:


plot(t,x)

title('This is my plot', 'FontSize', 24);


xlabel('x axis', 'FontSize', 24);
text(x, y, 'Hey, look at this', 'FontSize', 24);

 b     blue
 g     green
 r     red
 c     cyan
 m     magenta
 y     yellow
 k     black
 w     white

https://www.codegrepper.com/code-examples/c/
plot+color+matlab
change plot line color in matplotlib

plot(x, y, color='green', linestyle='dashed', marker='o',


markerfacecolor='blue', markersize=12).

figure bachground matlab colo

set(gcf,'color','w');

matlab plot colors

'y' yellow
'm' magenta
'c' cyan
'r' red
'g' green
'b' blue
'w' white
'k' black

You might also like