Borrar filtros
Borrar filtros

How to access the title of a matlab fig file

142 visualizaciones (últimos 30 días)
Theo
Theo el 24 de Jun. de 2015
Comentada: Theo el 24 de Jun. de 2015
I've opened a fig file. Let's call it
fig_1=openfig('sample.fig')
Now fig_1 is a figure object.
Where the title string of the relative plot is stored and how to get it? Thanks

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 24 de Jun. de 2015
Editada: Azzi Abdelmalek el 24 de Jun. de 2015
plot(1:10);
title('abc');
h1=get(gca,'title');
titre=get(h1,'string')
With newest version of Matlab
plot(1:10);title('abc');
h1=gca,
titre=h1.Title.String
  1 comentario
Theo
Theo el 24 de Jun. de 2015
Thanks Azzi. It works. however is there a way to extract the title string directly from the fig object rather than loading the fig file into a plot and then extracting the string from that? In other words is the title string accessible directly from the fig object? Thanks

Iniciar sesión para comentar.

Más respuestas (1)

Adam
Adam el 24 de Jun. de 2015
If you mean the figure title as you say then:
fig_1.Name
post R2014b or
get( fig_1, 'Name' )
before R2014b
gives you what is shown in the figure's title bar. If you really mean a plot title then refer to Azzi Abdelmalek's answer, but you should be careful to be more specific in your question if that is the case.

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by