[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using a global variable as default argument
From: |
Erik Leunissen |
Subject: |
Re: using a global variable as default argument |
Date: |
Sun, 23 Mar 2014 17:29:02 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
Darn. Another typo. Sorry, I'm hazy today.
Once more corrected.
Erik Leunissen.
--
-- script file tst.m --
function rv = f(v=pi)
rv = v;
endfunction
--
> tst
> f()
ans = 3.1416
OK, that works. However, the following doesn't:
-- script file tst.m --
global myconst = 1.2345;
function rv = f(v=myconst)
rv=v;
endfunction
--
> tst
> f()
error: 'myconst' undefined near line 3 column 19