Luke
Luke

Reputation: 31

Save output file from 'stats' command in gnuplot?

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

Upvotes: 0

Views: 961

Answers (2)

Addanki Ramesh
Addanki Ramesh

Reputation: 1

I know, I am responding too late, this might be useful in future

set print 'stats_output_file"
stats 'data_file' using 1:2

Upvotes: 0

grsousajunior
grsousajunior

Reputation: 778

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.

Upvotes: 2

Related Questions