Octave functions

149 views
Skip to first unread message

sajit

unread,
Oct 20, 2011, 6:54:43 AM10/20/11
to NYC Machine Learning Review
Sorry this looks really basic but Im not able to figure out what Im
doing wrong here.

I have my test file, testoctave.m , in which a function is defined.

When I call the function from the octave command line I get the error

error: `fn2' undefined near line 5 column 1

I did do an octave addpath of the location of the file. And I also
know the function is correct since when I defined the same function in
the octave command prompt it worked.

Any idea what is going wrong here?

Thanks

Niyant Dalal

unread,
Oct 20, 2011, 11:02:31 AM10/20/11
to nyc-machine-l...@googlegroups.com
I have yet to finish the last 2-3 videos in Octave - let me do that and I may be able to help you (or have the same problem).

But in the meanwhile, if you feel it apt, post it on the google groups of the meetup.

cheers
niyant

Jason Amster

unread,
Oct 20, 2011, 11:12:18 AM10/20/11
to nyc-machine-l...@googlegroups.com
Can you post the code? 

-----------------------------------
Jason Amster | BeenVerified, Inc.
Chief Technology Officer
404 Park Avenue S., 11th Floor | New York, New York 10016
jam...@beenverified.com | www.beenverified.com

sajit

unread,
Oct 20, 2011, 11:47:38 AM10/20/11
to NYC Machine Learning Review
This is function I've given in sample.m
--
function x = foo()
x = 1;
end
---


octave-3.4.0:17> ls
sample.m

octave-3.4.0:18> foo()
error: `foo' undefined near line 18 column 1



On Oct 20, 11:12 am, Jason Amster <jayams...@gmail.com> wrote:
> Can you post the code?
>
> -----------------------------------
> Jason Amster | BeenVerified, Inc.
> Chief Technology Officer
> 404 Park Avenue S., 11th Floor | New York, New York 10016
> jams...@beenverified.com |www.beenverified.com

Jason Amster

unread,
Oct 20, 2011, 12:16:12 PM10/20/11
to nyc-machine-l...@googlegroups.com
Try renaming the file to foo.m.  That should get it to work.  I'm not an Octave expert so there could be a way to get it to work where the file name is different, but file name and function name being the same should get you there.



-----------------------------------
Jason Amster | BeenVerified, Inc.
Chief Technology Officer
404 Park Avenue S., 11th Floor | New York, New York 10016

sajit mathew kunnumkal

unread,
Oct 20, 2011, 1:20:25 PM10/20/11
to nyc-machine-l...@googlegroups.com
Thanks Jason. 
That worked. Must have missed that part from the lectures. :-)


Sajit 
--
Sajit Mathew Kunnumkal
Reply all
Reply to author
Forward
0 new messages