What does this mean?

2 visualizaciones (últimos 30 días)
Husni
Husni el 27 de Oct. de 2012
Hi all
I am beginner in Matlab and currently learning about Matlab graph. I used this following code :
%%--------------------------------
t=0:0.1:10;
y1=sin(t);
y2=cos(t);
y3=t.^2;
f1=figure(1);
s1=subplot(2,1,1);
h1=plot(t,y1);
s2=subplot(2,1,2);
h2=plot(t,y2);
f2=figure(10);
h3=plot(t,y3);
get(0,'Children')
get(f1,'Children')
-------------------------------
the code
get(0,'Children')
will return
ans =
10
1
which is the 10 and 1 there can be understood referring to figure(10) and (1)
but when I tried
get(f1,'Children')
Matlab will return
ans =
175.0048
173.0048
I know that this number refer to s1 and s2. But My question is what does this number actually mean? or in simpler question : if I assume that I change the code (in subplot part ) to
f1=figure(1);
subplot(2,1,1);
h1=plot(t,y1);
subplot(2,1,2);
h2=plot(t,y2);
how do we know that those numbers refer to s1 and s2?
Any help is appreciated
Ali

Respuesta aceptada

Walter Roberson
Walter Roberson el 27 de Oct. de 2012
Editada: Walter Roberson el 27 de Oct. de 2012
The values you see such as 175.0048 have no documented inherent meaning. They are to be considered as arbitrary numbers that MATLAB matches against its internal tables.
When I tested a couple of years ago, I saw hints that there might be some internal structure to the numbers, that some of the bits might have meaning, but it was at most guidelines, sort of like saying "red vegetables are usually tomatoes" (but not all tomatoes are red, and not all red vegetables are tomatoes)
If you need to find out the axes that is the parent of a lineseries object, you can use
ancestor(h1, 'axes')
Often you can abbreviate that to
get(h1, 'Parent')
but sometimes there are other graphics objects in the middle.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by