help-octave
[Top][All Lists]
Advanced

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

Calling a function in a subdir without setting path in main script


From: Svante Signell
Subject: Calling a function in a subdir without setting path in main script
Date: Thu, 11 Mar 2010 13:48:44 +0100

Hi,

I want to call a function in a ./subdir using a persistent variable in a
function there. The problem is that this does not work, it has to be in
the current directory (it sets paths related to current directory) or I
have to set the path to ./subdir first. I don't want to set paths in the
main script, it should be done in the ./subdir/sub.m file. The reason
for all this is that I want only _one_ .m file in current directory!


Works (but not wanted)
======================
Version 1:

Current dir: .
./main.m:

result = sub()

./sub.m
addpath(./subdir)

Version 2:
./main.m
addpath('./subdir')
result = sub()

subdir/sub.m:
appath('./subdir')

Wanted
======
./main.m:

Try 1:
result = ./subdir/sub.m (does not work), is it possible at all?

Try 2:
cd subdir;
result = sub.m (does not work since ./subdir does not exist!

subdir/sub.m
addpath(./subdir) 



reply via email to

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