[scilab-Users] Variables scope in functions

Stéphane Mottelet stephane.mottelet at utc.fr
Fri Mar 25 09:17:50 CET 2011


Le 25/03/2011 08:59, Ruben Bibas a écrit :
> 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
Hi,

this is the normal Scilab behavior :

http://wiki.scilab.org/howto/global_and_local_variables

S.



More information about the users mailing list