Variables scope in functions

Ruben Bibas ruben.bibas at gmail.com
Fri Mar 25 08:59:06 CET 2011


Hello,
I used to use Matlab and now I am using Scilab a lot.
Is it possible to use functions in Scilab and have a variable scope
handling the same way Matlab is: it does not know of any variables
except the arguments of the functions ?
I find it very disturbing that function can know external variables
which are not global.
Besides, sometimes if you do use this functionality with matrices, and
try to redefine part of the matrix, it gets truncated.
(If t is defined outside of a function as a 10x12 matrix, and you say
inside the function t(3,8)=0, it gets truncated to 3x8.)

Anyhow, if there is a scopeMode = 0 switch, I would be very happy to
hear about it and if not, I would like to suggest it.

Thank you for your help!

Ruben



More information about the users mailing list