1

I have a simple gnuplot script that plots a bunch of graphs. When I run it, it gives the following error:

EDIT: I've reduced the length of the code considerably as per the suggestions

    ;
    set xrange [pe_cnt:range_high];
    set xtics xticks;
    set xtics add (pe_cnt) 
                                                                                 ^
line 26: invalid expression 

I've spent a lot of time in trying to solve this. I'd really appreciate if anyone could help me on this. This is my code:

range_high="`awk '{for(i=1;i<=NF;i++) if ($i=="--stop") print $(i+1)}' temp_info`"
xticks="`awk '{for(i=1;i<=NF;i++) if ($i=="--xticks") print $(i+1)}' temp_info`"
pe_cnt = "`awk '{for(i=1;i<=NF;i++) if ($i=="--pe_cnt") print $(i+1)}' temp_info`"
rd_cnt = "`awk '{for(i=1;i<=NF;i++) if ($i=="--rd_cnt") print $(i+1)}' temp_info`"


##################################################################################################
# Gnuplot script file for plotting Micron >= 1,16,32,64 WAFL single read last read


set autoscale    
set grid         
set title "Usable Flash Blocks vs PE cycles"

set xlabel "PE Cycles  "
set ylabel "% Usable Flash Blocks "
set y2label "% WAFL Blocks"

if (pe_cnt == range_high) {
    set xrange [pe_cnt-1:range_high]
    set xtics xticks
    set xtics add (pe_cnt-1) }
else { 
    set xrange [pe_cnt:range_high]
    set xtics xticks
    set xtics add (pe_cnt) }

set yrange [-10:140]
set y2range [-10:140]

set ytics 10
set y2tics 10

set term postscript color solid
set output 'Micron_srd.ps'

#set datafile separator ' '

set key top left
plot "Micron_all"      using (($1+1)*pe_cnt):(((256-$31)*100)/256)  smooth bezier  title '(>= 1 Bad WAFL)'      axis x1y1 with lines, \
     "Micron_all"      using (($1+1)*pe_cnt):(((256-$33)*100)/256)  smooth bezier  title '(>= 16 Bad WAFL)'      axis x1y1 with lines, \
     "Micron_all"      using (($1+1)*pe_cnt):(((256-$34)*100)/256)  smooth bezier  title '(>= 32 Bad WAFL)'      axis x1y1 with lines, \
     "Micron_all"      using (($1+1)*pe_cnt):(((256-$36)*100)/256)  smooth bezier  title '(>= 64 Bad WAFL)'      axis x1y1 with lines, \
     "Micron_all"      using (($1+1)*pe_cnt):(($14*400)/$5)  smooth bezier  title '(Uncorrectable WAFL)'      axis x1y2 with lines, \
     "Micron_all"      using (($1+1)*pe_cnt):(($70*100)/$5)  smooth bezier  title '(Correctable WAFL)'      axis x1y2 with lines
4

2 回答 2

1

问题可能pe_cnt不是数字,但您的测试用例不是自包含的(它从某个文件中读取此值),因此很难具体说明。

这是一个简短的、独立的示例,它使用相同的代码演示了相同的错误消息:

pe_cnt = "kittens"
set xtics add (pe_cnt)
于 2013-07-26T01:27:29.967 回答
1

利用

set xtics add (real(pe_cnt))

我猜,xtics add不会自动将字符串转换为数字,因为它在第一次遇到字符串时也允许使用不同的语法。以下是演员表:

set xtics add (pe_cnt pe_cnt)
于 2013-07-26T09:12:02.740 回答