[Scilab-users] Changing elements of "global" structure/vector in function

witkatz withold.gregoritza at gmx.de
Thu Nov 29 14:27:09 CET 2012


Inside the Scilab functions the variables declared in the base workspace can
only be read. For write access the variable has to be defined with the
global keyword.

global A;
A = [1, 2, 3];

function fun1()
    global A;
    disp(A);
    A(5) = 5;
    disp(A);
endfunction

-->fun1
    1.    2.    3.  
    1.    2.    3.    0.    5.  

regards witkatz



--
View this message in context: http://mailinglists.scilab.org/Scilab-users-Changing-elements-of-global-structure-vector-in-function-tp4025375p4025378.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list