1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
| ### combine lines of different subblocks into one line
reset session
# Define the number of files, max=6
file_count = 2
FILE1="noPWSOx1_sawoff/rhois.txt"
FILE2="noPWSOx1/rhois.txt"
FILE3="noPWSOx3/rhois.txt"
FILE4="noPWSOx4/rhois.txt"
FILE5="noPWSOx5/rhois.txt"
# ????block??col???
row=50
# the column numbers of two physical variables
col1=9
col2=1
# Initialize an empty list to hold file names
file_names = ""
if (file_count >=1) file_names = file_names . FILE1;
if (file_count >=2) file_names = file_names . " " .FILE2
if (file_count >=3) file_names = file_names . " " .FILE3
if (file_count >=4) file_names = file_names . " " .FILE4
if (file_count >=5) file_names = file_names . " " .FILE5
if (file_count >=6) file_names = file_names . " " .FILE6
# Split the file names into an array
file_list = word(file_names, 1)
do for [i=2:words(file_names)] {
file_list = file_list . " " . word(file_names, i)
}
# Initialize the plot command
plot_cmd = "plot "
# Process each file and add to the plot command
do for [i=1:words(file_list)] {
file = word(file_list, i)
set table $Temp
plot file u col1:col2 w table
unset table
if (i==1) {set print $Data1;}
if (i==2) {set print $Data2;}
if (i==3) {set print $Data3;}
if (i==4) {set print $Data4;}
if (i==5) {set print $Data5;}
if (i==6) {set print $Data6;}
N = |$Temp|
do for [j=row:N:55] {
print $Temp[j]." ".$Temp[j-1]
}
unset print
# Add data to plot command
if (i==1) {plot_cmd = plot_cmd . "'$Data1' u 1:2 w l title 'File".i."', "}
if (i==2) {plot_cmd = plot_cmd . "'$Data2' u 1:2 w l title 'File".i."', "}
if (i==3) {plot_cmd = plot_cmd . "'$Data3' u 1:2 w l title 'File".i."', "}
if (i==4) {plot_cmd = plot_cmd . "'$Data4' u 1:2 w l title 'File".i."', "}
if (i==5) {plot_cmd = plot_cmd . "'$Data5' u 1:2 w l title 'File".i."', "}
if (i==6) {plot_cmd = plot_cmd . "'$Data6' u 1:($4-$2) w l title 'File".i."', "}
}
# Remove the last comma and space
plot_cmd = substr(plot_cmd, 1, strlen(plot_cmd)-2)
print plot_cmd
# Execute the plot command
eval(plot_cmd)
### end of script
|