[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Please tell me if this code works
From: |
Ben Abbott |
Subject: |
Re: Please tell me if this code works |
Date: |
Sun, 10 Feb 2008 13:04:42 -0500 |
On Feb 10, 2008, at 12:39 PM, lc wrote:
Maybe I have a too old version of octave, but, please,
can you tell me if this code works:
function V= vol(h,s); V=h*s.R^2; endfunction
a.R=10
a.v=@(h)( vol(h, a ) );
a.v(2)
I got the error
error: `a' undefined near line ...
Thanks
lc
This is what I got.
octave:1> function V= vol(h,s); V=h*s.R^2; endfunction
octave:2> a.R=10
a =
{
R = 10
}
octave:3>
octave:3> a.v=@(h)( vol(h, a ) );
octave:4> a.v(2)
ans = 200
octave:5> ver
----------------------------------------------------------------------
GNU Octave Version 3.0.0+
GNU Octave License: GNU General Public License
Operating System: Darwin 9.1.0 Darwin Kernel Version 9.1.0: Wed Oct 31
17:46:22 PDT 2007; root:xnu-1228.0.2~1/RELEASE_I386 i386
----------------------------------------------------------------------
Ben