Script hierarchy.m
Download Script hierarchy.m
%Part A
x=0:0.1:2*pi;y=sin(x);h4=figure(4);
h_pl=plot(x,y)
hs=text('string','TITLE OF THE PLOT')
set(gca,'Title',hs)
class_h_pl=get(h_pl,'type')
class_hs=get(hs,'type')
h_title=get(gca,'Title')
class_h_title=get(h_title,'type')
%%
%Part B
h_pl_par=get(h_pl,'parent')
h_pl_chil=get(h_pl,'children')

hs_par=get(hs,'parent')
hs_chil=get(hs,'children')

h_ax=gca
h_ax_par=get(h_ax,'parent')
h_ax_chil=get(h_ax,'children')
class_ax=get(h_ax,'type')


h_fig=get(gca,'parent')
class_par=get(h_fig,'type')

h_root=get(h_fig,'parent')
class_root=get(h_root,'type')

Back