[Scilab-users] Strange list error
Adrien Vogt-Schilb
vogt at centre-cired.fr
Tue Jan 28 09:54:18 CET 2014
On 28/01/2014 09:41, Stefan Du Rietz wrote:
> On 2014-01-27 22:43, Serge Steer wrote:
> --------------------
>> Le 27/01/2014 19:05, Stefan Du Rietz a écrit :
>>> Hello Paul,
>>> after trying like a maniac ;-) I finally managed to reproduce it!
>>>
>>> The error shows up only when you run the command from the command
>>> window after a pause in the attached function testlisterror.sci.
>>>
>>> -->testlisterror("pnonfast","nonfast")
>>> -1->args(1) = null()
>>> args(1) = null()
>>> !--error 44
>>> Wrong argument #2.
>>>
>>> Without the pause it works OK.
>>>
>>> Regards
>>> Stefan
>> Under pause, you cannot modify a variable which is defined in the
>> calling context
>> so in such a context args is not a list as you expect but an empty
>> array which is implicitely created
>>
>> To make it work
>> you must do
>> -1-> args; //makes a local copy of args
>> -1->args(1) = null()
>>
>> Serge
>
> What do you mean by "defined in the calling context"?
> I can modify this:
>
> -1->isfast
> isfast =
> 0. 0.
> -1->isfast(1) = 1
> isfast =
> 1. 0.
>
> Stefan
>
>
Stefan, you may want to have a look at
http://wiki.scilab.org/howto/global%20and%20local%20variables
This page explains what Serge means i believe.
Adrien
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
--
Adrien Vogt-Schilb
PhD Student (Cired)
More information about the users
mailing list