How do I set the current axes to a saved axes?

24 visualizaciones (últimos 30 días)
Zachary Duff
Zachary Duff el 27 de Jun. de 2018
Comentada: Star Strider el 27 de Jun. de 2018
R2017a
So I made a graph using plot(), and tinkered around with the axes until I got it looking good and saved the axes
ax = gca;
% ... tinkering ..
save('ax.mat','ax');
Now I want to graph the same thing and just set the current axes to the one I saved. I've tried using stuff like getfield and findall but I can't seem to nail down exactly what I'm looking for.

Respuesta aceptada

Star Strider
Star Strider el 27 de Jun. de 2018
The savefig (link) function could be more appropriate, depending on what you want to do.
  2 comentarios
Zachary Duff
Zachary Duff el 27 de Jun. de 2018
Exactly what I was looking for. But now I'm curious, if I wanted to graph something different with the same XLabel, YLabel, etc, how would I do that? I guess I could just load the old figure and clear the lines.
Star Strider
Star Strider el 27 de Jun. de 2018
Correct. You would have to consider the loaded .fig file as an existing figure to change the information stored in it. The problem is that the R2014b ‘Handle Graphics 2’ made this (and several other graphics manipulations) significantly more challenging. Some are straightforward, others require that you use the findobj (link) and related functions. You would need that as for example:
h = findobj(gca,'Type','line')
to find the line objects if you want to change their properties.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by