【问题标题】:gnuplot macro dollar sign substitutiongnuplot 宏美元符号替换
【发布时间】:2014-10-22 16:28:35
【问题描述】:

在 Gnuplot 4.6.p3 中,当我调用一个脚本来选择我应该从文件中绘制哪一列时,通过

call 'FitModes.gnp' 12 "0.95" 1 "-50"

“FitModes.gnp”的(麻烦部分)是:

c(x)= x==1?'using 3:(abs($$5)):6': x==2?'using 3:(abs($$7)):8': x==3?'using 3:(abs($$9)):10':0    
column = c($2)
#print to check the value of this variable
print "column=",column

p "th$0/b$1/m$3/Data_$0-$1-$3.txt" @column t 'Data' w yerrorlines pt 7 lc @cblue

这给了我“无效的表达式”输出:

 gnuplot> call 'FitModes.gnp' "12" 0.95 1 "-50"
 column=using 3:(abs($5)):6

 gnuplot> p "th12/b0.95/m-50/Data_12-0.95--50.txt" using 3:(abs()):6 t 'Data' w yerrorlines pt 7 lc rgbcolor "#0083AB"

由于abs() 函数中没有列号,尽管$5 存在于column 变量中。知道为什么吗?

【问题讨论】:

    标签: macros gnuplot


    【解决方案1】:

    使用column 函数而不是使用快捷方式$... 引用列:

    c(x)= x==1?'using 3:(abs(column(5))):6': x==2?'using 3:(abs(column(7))):8': x==3?'using 3:(abs(column(9))):10':0    
    column = c($2)
    

    【讨论】:

    • 非常感谢!像魅力一样工作。
    猜你喜欢
    • 2018-01-15
    • 1970-01-01
    • 2021-07-13
    • 2016-02-13
    • 2013-01-11
    • 2011-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多