How can I change LineWidth of all lines in a printed figure from Simulink?

97 visualizzazioni (ultimi 30 giorni)
Hello, since the simplot-command isn't working in Matlab 2015 anymore, i tried to manually manipulate a plotted figure of a scope window after the simulation plotted it.
I am trying to find all lines and change the LineWidth and Color, see the attached m-file Image_Maxon_REmax29_ClosedLoop_2015.m
Also I am trying to adjust the inner border space of the image, so that the main title and axis titles can be read. Please see the attached image-file actual. My goal is to have an image like desired.
Can you help me please, to give me some tips?
Thanks in advance and with nice greetings, Lars

Risposte (1)

Sebastian Castro
Sebastian Castro il 22 Mag 2015
The documentation refers to simplot as being replaced with Simulink.sdi.view, which brings up the new Simulation Data Inspector which came out in R2014b:
Is this something you can use? If not, do you have a way of saving the figure as a MATLAB .fig file? Because that would be another way to make this much easier than an image processing problem.
- Sebastian
  2 Commenti
Lars Lindner
Lars Lindner il 22 Mag 2015
Hello Sebastian, thanks for your answer. I already saw the Simulation Data Inspector, but i didn't found an easy way to manipulate and save an image programmatically !
So I decided, to manipulate the image from a scope with the commands, you find in the m-file I attached.
How does it work, using a figure .fig file??
Thanks again and with nice greetings, Lars
PS: Whatever way to manipulate colors, linewidth , axes, title, etc. from a scope and save it as image file, is very welcome :)
Sebastian Castro
Sebastian Castro il 22 Mag 2015
Well, if you had a .fig file it would be ideal because MATLAB figures are easy to modify programmatically... scopes, not so much.
For instance, if you have a figure file, you can just do the following... although I see that you do this in your attached script anyway.
open('untitled.fig')
lines = findobj(gcf,'Type','Line');
for i = 1:numel(lines)
lines(i).LineWidth = 2.0;
end
One thing you can do with scopes in R2015a is to select the "Try Time Scope" button, which is the last button in the Scope's toolbar. If you do that, you see that it will change the type of scope. Once you do that, there is a "File > Print to Figure" option which will get you a figure out of the plot.
Once you have this figure, you can then run the above code on it.
How's this all sound?
- Sebastian

Accedi per commentare.

Categorie

Scopri di più su View and Analyze Simulation Results 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