A Gnuplot question

Vic Norton vic at norton.name
Thu Nov 27 09:06:41 CST 2008


Here's the situation.

The first lines of a gnuplot script are

    #!/usr/local/bin/gnuplot

    ## SE_2006-09-15_rank9.plot

    cd "~/octave/Markowitz_critical_line/Gnuplot";
    load 'data/assetSEpoints_2006-09-15_rank9.pts';
    load 'data/efficientFunctions_2006-09-15_rank9.fcn';

I want to distribute the folder, "Markowitz_critical_line", but  
clearly the gnuplot code is NOT portable unless a receiver of the  
distribution puts this "Markowitz_critical_line" folder in his own "~/ 
octave" directory.

The gnuplot script is in "Markowitz_critical_line/Gnuplot"; so what I  
really want is

    cd HERE;

where HERE is the directory of the calling script. Then the next two  
"load" lines will work fine no matter where someone puts the  
"Markowitz_critical_line" folder.

So my question is this: How do you define HERE in gnuplot?

In octave

    HERE = fileparts(mfilename("fullpath"));

Regards,

Vic

On Nov 26, 2008, at 7:53 PM, Vic Norton wrote:
> Unfortunately "help cd" is no help, Thomas.
> Syntax:
>      cd '<directory-name>'
> works if you know the directory-name. I want the Gnuplot script to
> tell me the name of the directory in which it resides. Then the code
> will be portable.
>


On Nov 26, 2008, at 8:36 PM, Ben Abbott wrote:

> I don't see what that has to do with making code portable. Can you  
> be more specific?



More information about the Help-octave mailing list