[Scilab-users] Invalid index?

antoine.elias at scilab-enterprises.com antoine.elias at scilab-enterprises.com
Thu Mar 31 09:32:28 CEST 2016


Hello,

Confirmed, failed on Scilab 5.5.2 but works in Scilab 6 beta 1

You can do that to by pass the problem :

god.vars = [];
for i=1:11
     disp(i);
     god.vars = [god.vars, uicontrol(god.frame1, 'style', 'text', 
'string', god.labels(i), 'position', [i*60 - 8 + fudge, 30, 10, 20 ])];
end

or

for i=1:11
     disp(i);
     uicontrol(god.frame1, 'style', 'text', 'string', god.labels(i), 
'position', [i*60 - 8 + fudge, 30, 10, 20 ]);
end

god.vars = god.frame1.children;



Le 2016-03-30 15:48, scilab.20.browseruk at xoxy.net a écrit :
> This one has me baffled!
> 
> If I run this code:
> ...
>     god.vars = [];
> for i=1:11
>     disp(i);
>     god.vars(i)  = 1; // uicontrol( god.frame1, 'style', 'text',
> 'string', god.labels(i), 'position', [ i*60 - 8 + fudge, 30, 10, 20 ]
> );
>     ...
> end
> 
> It completes without error.
> 
> But if I uncomment the uicontrol:
> 
>     god.vars(i)  = uicontrol( god.frame1, 'style', 'text', 'string',
> god.labels(i), 'position', [ i*60 - 8 + fudge, 30, 10, 20 ] );
> 
> The assignment to god.vars(i) works when i == 1;, but fails when i ==
> 2 as follows:
> 
> -->exec('C:\test\poly.sce', -1)
> 
>     1.
> 
>     2.
>     god.vars(i)  = uicontrol( god.frame1, 'style', 'text', 'string',
> god.labels(i), 'position', [ i*60 - 8 + fudge, 30, 10, 20 ] );
> 
>                                                             !--error
> 21
> Invalid index.
> at line      43 of exec file called by :
> exec('C:\test\poly.sce', -1)
> 
> I've eliminated the only other index usage (god.labels(i)) as a 
> problem;
> 
> so why can it assign to god,vars(1) and not to god.vars(2)?
> 
> Thanks Buk.
> 
> ____________________________________________________________
> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
> Check it out at http://www.inbox.com/earth
> 
> 
> 
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users



More information about the users mailing list