help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

testing global variable from within a function


From: ernst
Subject: testing global variable from within a function
Date: Sun, 27 Jan 2013 19:51:56 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120825 Thunderbird/15.0

Hi all,
I must check from within a function, whether a certain global variable
'myvarname' is defined.

What i know is, that from outside the function i just try
exist('myvarname', 'var').
>From within a function this does not work and i think
this is because I shall declare the variable global before.
But i have the impression, that 'global' defines a global variable, if
it is not yet defined,
otherwise makes the global variable already defined available.
So, testing whether it is global, does not make any sense within a
function,
because testing after declaring global returns true, testing before
returns false.

What can i do?

greetings, Ernst



reply via email to

[Prev in Thread] Current Thread [Next in Thread]