[Scilab-users] How to identify componants in a figure ?

classic Classic list List threaded Threaded
4 messages Options
Pierre PERRICHON Pierre PERRICHON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] How to identify componants in a figure ?

Hello

 

In my application, built with uicontrol in a main figure, I add graphs (Axes) with bode or Nyquist plot in the the main frame

 

So, at the end, if we do

f=gcf()

I get :

 

children: matrix 39x1

 

I add

a=f.children

 

Then a is a collection (with bode) :

 

Axes     

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

…..

uicontrol

uicontrol

uimenu   

uimenu   

Axes     

 

So, How can I get, in a loop with length(a), the numbers of the chidren who are Axes ?

 

In that case I hope something like [1, 39]

 

Is there a way to do that ?

I find nothing with the « get » function ?

 

Thanks

 

Pierre P.

 

 

 

 

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

Re: How to identify componants in a figure ?

Hi,
if you want to count how many axes-children there are in a figure, you may work with "tags".
Quick-n-dirty example below.
best regards,
Philipp

clc;
clear();

// create the figure
f = figure();

// first axes
plot3d();
a3d = gca();
a3d.tag = 'axes';

// menu
menu_1=uimenu(f,'label', '$\LaTeX$');
menu_1.tag = "menu";
// submenu
ml1=uimenu(menu_1,'label', '$\int_0^\infty\mathrm{e}^{-x^2}\,dx$');
ml2=uimenu(menu_1,'label', '$\frac\sqrt{\pi}2$');
ml1.tag = "submenu";
ml2.tag = "submenu";

// uicontrol
u=uicontrol(f,'style','listbox','position', [10 10 150 160]);
u.tag = "uicontrol";

// second axes
newaxes()
plot2d();
a2d = gca();
a2d.tag = "axes";

c = f.children

// from all figure children count the number of axes-children
count = 0;
for i = 1:length(c)
    str = c(i).tag;
    if(str == "axes")
        count = count+1;
    end
end
printf("there are %d axes children in f \n", count);

// get the position of the axes children from all figure children
position = zeros(count,1);
j = 0;
for i = 1:length(c)
    str = c(i).tag;
    if(str == "axes")
        j = j+1;
        position(j) = i;
    end
end
printf("axes children of f can be found at position %d \n", position);

Am Fr., 11. Okt. 2019 um 11:19 Uhr schrieb Perrichon <[hidden email]>:

Hello

 

In my application, built with uicontrol in a main figure, I add graphs (Axes) with bode or Nyquist plot in the the main frame

 

So, at the end, if we do

f=gcf()

I get :

 

children: matrix 39x1

 

I add

a=f.children

 

Then a is a collection (with bode) :

 

Axes     

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

uicontrol

…..

uicontrol

uicontrol

uimenu   

uimenu   

Axes     

 

So, How can I get, in a loop with length(a), the numbers of the chidren who are Axes ?

 

In that case I hope something like [1, 39]

 

Is there a way to do that ?

I find nothing with the « get » function ?

 

Thanks

 

Pierre P.

 

 

 

 

 

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Re : How to identify componants in a figure ?

In reply to this post by Pierre PERRICHON
Hello Pierre,

Just do find(a.type=="Axes")

Regards
Samuel
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pierre PERRICHON Pierre PERRICHON
Reply | Threaded
Open this post in threaded view
|

Re: Re : How to identify componants in a figure ?

Hello,

I thanks all the scilabers for their response:
Antoine, Stephane, Philipp, Samuel

I've try with the "find" function

The result is perfectly what I was waiting for

Also great thanks to everybody
it takes away a thorn from foot

my nice GUI well works now

Best regards


-----Message d'origine-----
De : users <[hidden email]> De la part de [hidden email]
Envoyé : vendredi 11 octobre 2019 16:16
À : Users mailing list for Scilab <[hidden email]>
Objet : [Scilab-users] Re : How to identify componants in a figure ?

Hello Pierre,

Just do find(a.type=="Axes")

Regards
Samuel
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users