【问题标题】:macros with arguments in gnuplotgnuplot 中带参数的宏
【发布时间】:2017-05-20 08:41:47
【问题描述】:

在 gnuplot 中有没有一种方法可以在宏中组合 gnuplot 命令和函数?

一个例子如下:

例如,在 gnuplot 中我可以这样做

set_output = "set output"
pdf_output(x) = x.".pdf"
@set_output pdf_output(mypdf)

这将相当于行

set output "mypdf.pdf"

有什么方法可以定义一个函数

somefunction(x) = set output x.".pdf"
@somefunction(mypdf)

会等同于同一件事吗?

设置输出“mypdf.pdf”

【问题讨论】:

    标签: function macros command gnuplot


    【解决方案1】:

    为此,您可以使用eval

    out(x) = sprintf("set output '%s.pdf'", x)
    eval(out("file"))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多