在gnuplot中保存“ stats”命令的输出文件?

时间:2019-05-01 14:32:24

标签: linux gnuplot

我想将'stats'命令的输出保存在gnuplot中作为文件。 我尝试分析多个.dat文件,并根据它们的最小值,最大值,平均值和标准差派生进行比较。因此,我需要创建一个包含这些值的文件,甚至可以将我所有的600个.dat文件都放在一个文件中

1 个答案:

答案 0 :(得分:1)

我知道您的问题被linux标记了。但是,这个答案(在Windows下)也许可以为您提供帮助。 假设您有.dat个文件,其中包含以下内容:

# 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

要打印每个文件的最小值,请执行以下操作:

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

MinValues.log现在包含:

1.0
11.0
21.0

您可以使用相同的逻辑来创建一个具有最大值,平均值的文件,或者创建更多列。

我希望这会有用。

相关问题