[Scilab-users] Invalid index?

scilab.20.browseruk at xoxy.net scilab.20.browseruk at xoxy.net
Wed Mar 30 15:48:32 CEST 2016


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






More information about the users mailing list