A Gnuplot question

Ben Abbott bpabbott at mac.com
Thu Nov 27 10:21:36 CST 2008


Vic,

Did you see Dieter's response?

In any event, I assume you are calling your script from the directory  
"Markowitz_critical_line", correct?

Why not make use of "." ... which is synonymous with the present  
working directory?

>   #!/usr/local/bin/gnuplot
>
>   ## SE_2006-09-15_rank9.plot
>
>   cd "./Gnuplot";
>   load './data/assetSEpoints_2006-09-15_rank9.pts';
>   load './data/efficientFunctions_2006-09-15_rank9.fcn';


Perhaps you might avoid using "cd"?

>   #!/usr/local/bin/gnuplot
>
>   ## SE_2006-09-15_rank9.plot
>
>   load './Gnuplot/data/assetSEpoints_2006-09-15_rank9.pts';
>   load './Gnuplot/data/efficientFunctions_2006-09-15_rank9.fcn';

That won't work if you're calling your script from somewhere other  
than the "Markowitz_critical_line" folder.

Ben

On Nov 27, 2008, at 10:06 AM, Vic Norton wrote:

> 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