gpt4 book ai didi

linux - GNUPLOT:无效的表达?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:23:14 25 4
gpt4 key购买 nike

我有一个简单的 gnuplot 脚本,可以绘制一堆图表。当我运行它时,它给出了以下错误:

编辑:我已经根据建议大大减少了代码的长度

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

我花了很多时间试图解决这个问题。如果有人可以帮助我,我将不胜感激。这是我的代码:

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

最佳答案

使用

set xtics add (real(pe_cnt))

我想,xtics add 不会自动将字符串转换为数字,因为当第一次遇到字符串时它也允许使用不同的语法。执行以下操作:

set xtics add (pe_cnt pe_cnt)

关于linux - GNUPLOT:无效的表达?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17868847/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com