Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Fortran 90: Tab characters?

Fortran 90: Tab characters?

Fortran 90: Tab characters?


I have small Fortran 90 question (compaq visual fortran).

I want to write a matrix in an output file, and separate each element of the matrix by a "tab-character". I have found the control edit descriptors to make a tab character in fortran output (e.g. TR1, TL1 or T1), but when I run my code Fortran always seems to write a space instead! This makes it difficult to directly open my text file in excel.

Is it possible to write Tab characters between elements of a matrix please in Fortran? I have included an example of my code below.

Thanks a lot!


write(910, fmt = '(3(es12.6e2,TR1))', advance = 'yes') 1.0d0, 2.0d0, 3.0d0

RE: Fortran 90: Tab characters?

The "TL" and "TR" format specifiers just change the position in the current line where the next part of the output will go; they don't result in insertion of tab characters.

Doing what you want is fairly easy. Basically, you want to write a character that has the value of the tab, which is 09. One way is to define a character variable of length one and initialize it to CHAR(9); then just include that variable in the I/O list, with an A format spec to go with it. You could imbed the character in a literal in the format string, but the appearance on screen with your editor may look strange and be hard to work with.

RE: Fortran 90: Tab characters?

If you're going to import into Excel, it would be better to use comma separated.

If you really want tabs, use char(9)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close