help-octave
[Top][All Lists]
Advanced

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

Re: addpath, undefined functions


From: Philip Nienhuis
Subject: Re: addpath, undefined functions
Date: Mon, 11 Jul 2011 23:12:27 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Hi Peter,

(please do "reply all" so others can follow. address@hidden added to To:)

Summers, Peter wrote:
1. What is the exact path to the Octave install directory? Does it contain
spaces (e.g.,"C:\Program Files\Octave" ?)

No -- I followed the default installation. It's C:\Octave\3.2.4_gcc-4.4.0

OK

2. Exactly what did the addpath() command look like?
<snip>
I combined this with your suggestion below about installing user scripts 
outside octave. So I used
addpath("C:\\users\\Bob&  Alice\\Documents\\octave");

(Is the ampersand position a typo? especially given the output of your path() command, where it says:
"
Octave's search path contains the following directories:
C:\users\Bob & Alice\Documents\octave
")

You can simply use single quotes and single backslashes.
Spaces in the path name had better be avoided, though on my PC (WinXP) that makes no difference, even multiple spaces.

<snip>
Here's coher (I didn't write it). cospec is another function in the same 
directory, and I think spec is in the signal package, which I've also installed.

Is function coher in a file called coher.m ?

function h=coher(x,y,m,method)
<snip>

Looks OK

For a start, you can try to put a simple function file test.m at the same
location and see if it gets picked up:

#======= cut here =========
ret = function test (a, b)
ret = a + b;
endfunction
#======= cut here =========

and calling it by c = test (a, b)

The test function works (after correcting the first line to 'edit '). I pasted 
this into notepad++, saved it to the same directory (c:\users\...\octave), and 
it ran fine. It generates an error if I try to access it from the install 
directory though:

Oopsie, yep I typed too fast :-)

octave-3.2.4.exe:38>  c = test(a,b)
error: Invalid call to test.  Correct usage is:

  -- Function File:  test NAME
  -- Function File:  test NAME quiet|normal|verbose
  -- Function File:  test ('NAME', 'quiet|normal|verbose', FID)
  -- Function File:  test ([], 'explain', FID)
  -- Function File: SUCCESS = test (...)
  -- Function File: [N, MAX] = test (...)
  -- Function File: [CODE, IDX] = test ('NAME','grabdemo')

Sorry, I forgot that "test" is an internal function.
Better rename to testa.m, containing first line "function ret = testa (a, b)"

Nevertheless, as internal test() isn't "shadowed" we can conclude your test.m isn't seen.

Wat if you do (in Octave):
 cd ('C:\users\Bob & Alice\Documents\octave')
 dir

Does coher.m show up?

>
> I hope the additional info is useful.

Yes, this helps to clarify.
But unfortunately I have run out of ideas; I don't have win7, only XP.
All I can say is that usually these type of seemingly enigmatic errors are caused by simple glitches of the typo/forgot-to-copy/etc. variety.

Philip


reply via email to

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