使用特定的 FMT 将不同类型的变量写入同一行
我想在同一行上的一系列具有特定格式的整数前面写入一系列字符。例如,如下所示:C1 C2 C3 C4 C5 C6
。
到目前为止,我成功地对一种类型的变量使用了 ADJUSTL(FMT) 选项:
WRITE(FMT,*) j
WRITE(*,"( "// ADJUSTL(FMT) //" a3)") (Letters(i),i=1,j)
其中,Letters 是字符数组,i,j 是整数。它正确显示CCCCC C
。
我尝试了几种不同的组合,以便在字符旁边添加整数,但尚未找到正确的解决方案。我正在使用 gfortran 编译我的 F90 代码。
I would like to write a series of characters preceeding a series of integers with a specific format on the same line. Like the following: C1 C2 C3 C4 C5 C6
, for instance.
I succeeded to use the ADJUSTL(FMT)
option for one type of variable so far:
WRITE(FMT,*) j
WRITE(*,"( "// ADJUSTL(FMT) //" a3)") (Letters(i),i=1,j)
Where Letters
is a character array and i,j
are integers. It displays correctly C C C C C C
.
I've tried few different combinations in order to add the integers next to the characters but didn't find the right solution yet. I'm using gfortran to compile my F90 code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论