我想将gnuplot中'stats‘命令的输出另存为一个文件。我尝试分析多个.dat文件,并根据它们的最小值、最大值、平均值、标准差来比较它们。因此,我需要创建一个包含这些值的文件,甚至可以在一个文件中包含所有600个.dat文件
发布于 2019-05-01 19:08:44
我知道你的问题是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
您可以使用相同的逻辑创建一个具有最大值、平均值或创建更多列的文件。
我希望这是有用的。
https://stackoverflow.com/questions/55937884
复制相似问题