Save output file from 'stats' command in gnuplot?

Issue

I want to save the output from the ‘stats’ command in gnuplot as a file.
I try to analyse multiple .dat files and compare them according to their min, max, mean, std derivation. So I need to create a single file containing these values, possible even from all my 600 .dat files in one

Solution

I know than your question is linux tagged. But may this answer (under Windows) maybe help you.
Suppose that you have .dat files containing like this:

# File 01.dat
1
2
3
4
5
6
7
8
9
10
# File 02.dat
11
12
13
14
15
16
17
18
19
20
# File 03.dat
21
22
23
24
25
26
27
28
29
30

To prints the minimum value of each file do you do this:

ListOfFiles = system('dir /b *.dat') # Get all .dat files in current directory
set print 'MinValues.log'            # Define a filename to save the values
    do for [file in ListOfFiles]{    # Loop for each file in 'ListOfFiles'
        stats file nooutput          # Get statistics and turn off the output
        print STATS_min              # Print the minimum into file
    }                                # Close the loop
unset print                          # Turn off the print

The MinValues.log now contains:

1.0
11.0
21.0

You would can use the same logic to create one file with max, mean values or creates more columns instead.

I hope this be useful.

Answered By – grsousajunior

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published