Gnuplot: How to load and display single numeric value from data file

后端 未结 2 1108
有刺的猬
有刺的猬 2020-12-01 15:33

My data file has this content

# data file for use with gnuplot
# Report 001
# Data as of Tuesday 03-Sep-2013 
total   1976
case1   522 278 146 65  26  7
case         


        
2条回答
  •  既然无缘
    2020-12-01 16:00

    For linux and similar.

    If you don't know the row number where your data is located, but you know it is in the n-th column of a row where the value of the m-th column is x, you can define a function

    get_data(m,x,n,filename)=system('awk "\$'.m.'==\"'.x.'\"{print \$'.n.'}" '.filename)
    

    and then use it, for example, as

    y = get_data(1,"case2",4,"datafile.txt")
    

    using data provided by user424855

    print y
    

    should return 15

提交回复
热议问题