質問編集履歴
5
誤字
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
fortran90プログラム
|
1
|
+
fortran90プログラムでの、フォルダ内にある連番のtxtファイルの読み込み
|
test
CHANGED
File without changes
|
4
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,206 +24,206 @@
|
|
24
24
|
|
25
25
|
write (filename, '(trim(dataname),'_',i3.3,'bw.txt')'),10,i
|
26
26
|
|
27
|
+
open(10, file=trim(filename), status='old')
|
28
|
+
|
29
|
+
のようにすると以下のようなエラーが出ます。
|
30
|
+
|
31
|
+
解決方法か、何か他に良いやり方があればご教授下さい。
|
32
|
+
|
33
|
+
```
|
34
|
+
|
35
|
+
エラーメッセージ
|
36
|
+
|
37
|
+
C:\Users\Desktop\2\binarization_for_txt22 - .f90:30:42:
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
30 | write (filename, '(trim(dataname),'_',i3.3,'bw.txt')'),10,i
|
42
|
+
|
43
|
+
| 1
|
44
|
+
|
45
|
+
Error: Syntax error in WRITE statement at (1)
|
46
|
+
|
47
|
+
C:\Users\Desktop\2\binarization_for_txt22 - .f90:61:16:
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
61 | write (fname, '(i3.3,'bw.txt')'),11,i
|
52
|
+
|
53
|
+
| 1
|
54
|
+
|
55
|
+
Error: Syntax error in WRITE statement at (1)
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
### 該当のソースコード
|
62
|
+
|
63
|
+
fortran90
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
program main
|
68
|
+
|
69
|
+
implicit none
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
character*30 filename !txtファイルの名前
|
74
|
+
|
75
|
+
character*30 dataname !txtファイルの名前の拡張子,連番を除いた部分
|
76
|
+
|
77
|
+
character*30 fname
|
78
|
+
|
79
|
+
character*1 dummy
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
integer :: i,j,k !繰り返し変数
|
84
|
+
|
85
|
+
integer, dimension(1,800):: pix1 !txtファイルの0~255までの数字
|
86
|
+
|
87
|
+
integer, dimension(800,800):: pix
|
88
|
+
|
89
|
+
integer :: thr !2値化の際の閾値
|
90
|
+
|
91
|
+
integer :: Nmax !txtファイルの数
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
print*,"input condition name. ex)1o10C334000_1"
|
98
|
+
|
99
|
+
read*, dataname !abcdeの部分
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
print*,"input the number of txt_file"
|
106
|
+
|
107
|
+
read*, Nmax
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
print*,"What is the threshold?"
|
112
|
+
|
113
|
+
read*, thr
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
do i=0, Nmax
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
write (filename, '(trim(dataname),'_',i3.3,'bw.txt')'),10,i
|
126
|
+
|
27
127
|
|
28
128
|
|
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
|
-
pr
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
i
|
88
|
-
|
89
|
-
inte
|
90
|
-
|
91
|
-
int
|
92
|
-
|
93
|
-
|
129
|
+
|
130
|
+
|
131
|
+
open(10, file=trim(filename), status='old')
|
132
|
+
|
133
|
+
print*, trim(filename)
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
do j=1,1
|
144
|
+
|
145
|
+
read(10,*) (pix1(j,k), k=1,768)
|
146
|
+
|
147
|
+
end do
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
do j=1,768
|
152
|
+
|
153
|
+
read(10,*) (pix(j,k), k=1,769)
|
154
|
+
|
155
|
+
end do
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
do j=2,769
|
162
|
+
|
163
|
+
do k=2,768
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
if (pix(j,k)<thr) then
|
168
|
+
|
169
|
+
pix(j,k)=0
|
170
|
+
|
171
|
+
else
|
172
|
+
|
173
|
+
pix(j,k)=255
|
174
|
+
|
175
|
+
end if
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
end do
|
180
|
+
|
181
|
+
end do
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
write (fname, '(i3.3,'bw.txt')'),11,i
|
188
|
+
|
189
|
+
open(11,file=trim(fname),status='new')
|
190
|
+
|
191
|
+
print*, trim(fname)
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
do j=1,1
|
196
|
+
|
197
|
+
write(11,*) (pix1(j,k), k=1,768)
|
198
|
+
|
199
|
+
end do
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
do j=1,768
|
204
|
+
|
205
|
+
write(11,*) (pix(j,k), k=1,769)
|
206
|
+
|
207
|
+
end do
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
close(11)
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
close(10)
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
end do
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
94
226
|
|
95
227
|
|
96
228
|
|
97
|
-
print*,"input condition name. ex)1o10C334000_1"
|
98
|
-
|
99
|
-
read*, dataname !abcdeの部分
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
print*,"input the number of txt_file"
|
106
|
-
|
107
|
-
read*, Nmax
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
print*,"What is the threshold?"
|
112
|
-
|
113
|
-
read*, thr
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
do i=0, Nmax
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
write (filename, '(trim(dataname),'_',i3.3,'bw.txt')'),10,i
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
open(10, file=trim(filename), status='old')
|
132
|
-
|
133
|
-
print*, trim(filename)
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
do j=1,1
|
144
|
-
|
145
|
-
read(10,*) (pix1(j,k), k=1,768)
|
146
|
-
|
147
|
-
end do
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
do j=1,768
|
152
|
-
|
153
|
-
read(10,*) (pix(j,k), k=1,769)
|
154
|
-
|
155
|
-
end do
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
do j=2,769
|
162
|
-
|
163
|
-
do k=2,768
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
if (pix(j,k)<thr) then
|
168
|
-
|
169
|
-
pix(j,k)=0
|
170
|
-
|
171
|
-
else
|
172
|
-
|
173
|
-
pix(j,k)=255
|
174
|
-
|
175
|
-
end if
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
end do
|
180
|
-
|
181
|
-
end do
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
write (fname, '(i3.3,'bw.txt')'),11,i
|
188
|
-
|
189
|
-
open(11,file=trim(fname),status='new')
|
190
|
-
|
191
|
-
print*, trim(fname)
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
do j=1,1
|
196
|
-
|
197
|
-
write(11,*) (pix1(j,k), k=1,768)
|
198
|
-
|
199
|
-
end do
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
do j=1,768
|
204
|
-
|
205
|
-
write(11,*) (pix(j,k), k=1,769)
|
206
|
-
|
207
|
-
end do
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
close(11)
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
close(10)
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
end do
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
```
|
229
|
+
```
|
3
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,6 +16,8 @@
|
|
16
16
|
|
17
17
|
### 発生している問題・エラーメッセージ
|
18
18
|
|
19
|
+
abcdeの部分を変数datanameに渡した後
|
20
|
+
|
19
21
|
write文を用いて
|
20
22
|
|
21
23
|
do i=0, Nmax
|
2
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,12 +16,42 @@
|
|
16
16
|
|
17
17
|
### 発生している問題・エラーメッセージ
|
18
18
|
|
19
|
-
|
19
|
+
write文を用いて
|
20
|
+
|
21
|
+
do i=0, Nmax
|
22
|
+
|
23
|
+
write (filename, '(trim(dataname),'_',i3.3,'bw.txt')'),10,i
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
のようにすると以下のようなエラーが出ます。
|
28
|
+
|
29
|
+
解決方法か、何か他に良いやり方があればご教授下さい。
|
20
30
|
|
21
31
|
```
|
22
32
|
|
23
33
|
エラーメッセージ
|
24
34
|
|
35
|
+
C:\Users\Desktop\2\binarization_for_txt22 - .f90:30:42:
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
30 | write (filename, '(trim(dataname),'_',i3.3,'bw.txt')'),10,i
|
40
|
+
|
41
|
+
| 1
|
42
|
+
|
43
|
+
Error: Syntax error in WRITE statement at (1)
|
44
|
+
|
45
|
+
C:\Users\Desktop\2\binarization_for_txt22 - .f90:61:16:
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
61 | write (fname, '(i3.3,'bw.txt')'),11,i
|
50
|
+
|
51
|
+
| 1
|
52
|
+
|
53
|
+
Error: Syntax error in WRITE statement at (1)
|
54
|
+
|
25
55
|
```
|
26
56
|
|
27
57
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -195,19 +195,3 @@
|
|
195
195
|
|
196
196
|
|
197
197
|
```
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
### 試したこと
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
ここに問題に対して試したことを記載してください。
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
### 補足情報(FW/ツールのバージョンなど)
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
ここにより詳細な情報を記載してください。
|