[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Returned value from function as a global variable
From: |
LUK ShunTim |
Subject: |
Returned value from function as a global variable |
Date: |
Thu, 25 Sep 2008 00:20:13 +0800 |
User-agent: |
Mozilla-Thunderbird 2.0.0.16 (X11/20080724) |
Hi,
I had some matlab code which uses global variables to allow common
access to returned values from functions. It appears that octave doesn't
allow such behaviour. Here's a short function which produces an error in
octave.
function [v]=t_global_f(x)
global v;
v = sin(x);
endfunction
octave:1> x=0:0.1:pi;
octave:2> v=t_global_f(x);
error: can't make function parameter `v' global
error: evaluating global command near line 6, column 1
error: called from `t_global_f' in file
`/home/0/00work/octave/00snippets/t_global_f.m'
error: evaluating assignment expression near line 2, column 2
Is there any plan to implement the same behaviour in octave?
Regards,
ST
--
- Returned value from function as a global variable,
LUK ShunTim <=