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

P M p.muehlmann at gmail.com
Fri Oct 11 16:07:04 CEST 2019


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 figuref = figure();
// first axesplot3d();a3d = gca();a3d.tag = 'axes';
// menumenu_1=uimenu(f,'label', '$\LaTeX$');menu_1.tag = "menu";//
submenuml1=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";
// uicontrolu=uicontrol(f,'style','listbox','position', [10 10 150
160]);u.tag = "uicontrol";
// second axesnewaxes()plot2d();a2d = gca();a2d.tag = "axes";
c = f.children
// from all figure children count the number of axes-childrencount =
0;for i = 1:length(c)
    str = c(i).tag;
    if(str == "axes")
        count = count+1;
    endendprintf("there are %d axes children in f \n", count);
// get the position of the axes children from all figure
childrenposition = zeros(count,1);j = 0;for i = 1:length(c)
    str = c(i).tag;
    if(str == "axes")
        j = j+1;
        position(j) = i;
    endendprintf("axes children of f can be found at position %d \n", position);


Am Fr., 11. Okt. 2019 um 11:19 Uhr schrieb Perrichon <
perrichon.pierre at wanadoo.fr>:

> 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
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191011/f1ddadfa/attachment.htm>


More information about the users mailing list