Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot: store last data point as variable

Tags:

gnuplot

I was wondering if there is an easy way, using Gnuplot, to get the last point in a data file say data.txt and store the values in a variable.

From this question, accessing the nth datapoint in a datafile using gnuplot I know that I can get the X-Value using stats and GP_VAL_DATA_X_MAX variable, but is there a simple trick to get the corresponding y-value?

like image 595
Jack Avatar asked May 17 '16 14:05

Jack


1 Answers

A third possibility is to write each ordinate value into the same user variable during plotting. Last value stays in:

 plot dataf using 1:(lasty=$2)
 print lasty
like image 165
Karl Avatar answered Oct 04 '22 02:10

Karl