"call" a script with an index notation

View: New views
2 Messages — Rating Filter:   Alert me  

"call" a script with an index notation

by CPTZ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm running into a problem calling a script with an index notation in it, and with incomplete string recognition/pasing.

1st the incomplete string passing:

Here are the relevant lines from my script file:

set terminal postscript eps enhanced color
set output "$1.ps"
set title "$1"
plot "Data.txt" using 2:7:(100*($$15-.60)) with points pointtype 6 pointsize variable

I've doubled the $ within the using command to pull column data from the file as the help call says to -no problems there.

Here is my call command:

call 'index.script' ''89text-1''

It works, except it only passes the 89 to the file name and title.

So the output file is called 89.ps instead of 89text-1.ps
which is a problem, because eventually I'll have a -2 and -3 etc.

(and, the help says the parameters start at 0- this seems to show they start at 1, is the help correct?  If i start with $0 it doesn't pass the string at all)

--2nd problem--  it doesn't like passing a parameter to an index command
if I use my full 'line 19':

plot "AllData.txt" using 2:7:(100*($$15-.60)) index $2 with points pointtype 6 pointsize variable

and use the call command:

call 'index.script' ''89AZ-21'' '0'

I get the following error message:
 "index.script", line 19: undefined variable: AZ

It's passing the next part of the string to parameter 2 instead of parameter 2.

Any insight or suggestions for me to get this working?

Thanks







Re: "call" a script with an index notation

by Thomas Sefzick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

if you insert the line (see 'help call')
print "argc=$# p0=$0 p1=$1 p2=$2 p3=$3 p4=$4 p5=$5 p6=$6 p7=x$7x"
into your called script, then you can see all the arguments.

your problem seem to be the double quotation marks you
obviously made out of 2 apostrophes:
gnuplot> call 'calltest.gp' ''89AZ-21'' '0'
argc=7 p0= p1=89 p2=AZ p3=- p4=21 p5= p6=0 p7=xx

with real double quotes it works:
gnuplot> call 'calltest.gp' "89AZ-21" '0'
argc=2 p0=89AZ-21 p1=0 p2= p3= p4= p5= p6= p7=xx

CPTZ wrote:
I'm running into a problem calling a script with an index notation in it, and with incomplete string recognition/pasing.

1st the incomplete string passing:

Here are the relevant lines from my script file:

set terminal postscript eps enhanced color
set output "$1.ps"
set title "$1"
plot "Data.txt" using 2:7:(100*($$15-.60)) with points pointtype 6 pointsize variable

I've doubled the $ within the using command to pull column data from the file as the help call says to -no problems there.

Here is my call command:

call 'index.script' ''89text-1''

It works, except it only passes the 89 to the file name and title.

So the output file is called 89.ps instead of 89text-1.ps
which is a problem, because eventually I'll have a -2 and -3 etc.

(and, the help says the parameters start at 0- this seems to show they start at 1, is the help correct?  If i start with $0 it doesn't pass the string at all)

--2nd problem--  it doesn't like passing a parameter to an index command
if I use my full 'line 19':

plot "AllData.txt" using 2:7:(100*($$15-.60)) index $2 with points pointtype 6 pointsize variable

and use the call command:

call 'index.script' ''89AZ-21'' '0'

I get the following error message:
 "index.script", line 19: undefined variable: AZ

It's passing the next part of the string to parameter 2 instead of parameter 2.

Any insight or suggestions for me to get this working?

Thanks