2012-03-27 15 views

Odpowiedz

21
x=0:.1:3.14; 
plot(sin(x)) 
title('Sin(x)') 

%get the title 
h=get(gca,'Title'); 
t=get(h,'String') %t is now 'Sin(x)' 

%new title 
new_t=strcat(t,' Sine function') 
title(new_t) 
+0

niesamowite! DZIĘKI! To właśnie jest to, czego szukałem! – dewalla

0

Podany uchwyt do okna z rysunkiem pokazuje, jak "dostać" i "ustawić" "tytuł" rysunku.

Uruchom następujące wiersze kodu i przekonaj się sam. Użyłem Matlab 2016a.

Oto podsumowanie:

h = figure; 
h.Children.Title.String = 'Your desired title'; 
disp(['Current Figure Title: ', h.Children.Title.String]); 
figure(h); 

Stwórz postać demo z tytułem: 'test tytułów 1'

h = figure; 
title('Test Title-1'); 

dostępu tytuł postać poprzez uchwyt: h

figTitle = h.Children.Title.String; 
disp(['Current Figure Title: ',figTitle]); 
figure(h); 

zmienić tytuł rysunek do czegoś nowego: 'test Tytuł-2'

h.Children.Title.String = 'Test Title-2'; 
disp(['New Figure Title:',h.Children.Title.String]); 
figure(h); 
Powiązane problemy