On 2014-01-28 09:54, Adrien Vogt-Schilb wrote:
--------------------
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

Thank you Adrien, but I have had many looks at it ;-)

I still don't understand the difference between my variables args and isfast. They are both defined in the function.

args: input values of the function are assigned to the corresponding local variables of the function (local variables and scoping 5.)

isfast: local variables defined at level_N remain local at that level. (local variables and scoping 2.).

What am I missing? Am I just stupid?

Stefan



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

Reply via email to