Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Odd behavior

Brooks_Van_Horn
New Contributor I
548 Views

I am using ivf 2018 u3 on a Win 10 machine and I've run into an odd behavior that I cannot fix. First I show you the output on the console:

Name      Var.        xbar
N                1          11.5406
1/N            2           0.1039
1/N^2      3           0.0129
Y          4          67.8702

Name      Var.        Std.Dev.
N                1           4.7798
1/N            2           0.0476
1/N^2      3           0.0118
Y          4          15.7757

All the arithmetic is correct but the format is messy. I was using a format statement with the fields: "A, T11, i2, T15, f15.4" and then I tried something a little different:but I get exactly the same results. Here is the code:

	do i = 1, nVars
           mLine = '                                                       '
           mLine(1:9) = Names(i)(1:9)
           write(mLine(11:12),'(i2)') i
           write(mLine(15:30),'(f15.4)') xb(i)
	   write(6,'(a30)') mLine(1:30)
       end do

I am using a Courier font. Does anyone have a suggestion? I am at a loss.

Thanks, Brooks

0 Kudos
1 Solution
JVanB
Valued Contributor II
548 Views

Try putting

write(6,*) ichar(transfer(Names(i)(1:9),['A']))

in the loop so we can see if there are any hidden characters (like HT) in the Names strings.

 

View solution in original post

0 Kudos
4 Replies
JVanB
Valued Contributor II
549 Views

Try putting

write(6,*) ichar(transfer(Names(i)(1:9),['A']))

in the loop so we can see if there are any hidden characters (like HT) in the Names strings.

 

0 Kudos
IanH
Honored Contributor II
548 Views

What is the length of the `Names` object?  Is its LEN more than 9?

0 Kudos
GVautier
New Contributor II
548 Views

Hello

Why not ?

	       write(6,'(A9,2x,i2,2x,F15.4)')Names(i),i,xb(i)

 

0 Kudos
Brooks_Van_Horn
New Contributor I
548 Views

Thanks, the problem was tab characters within Names(*), which I had read from a text file.

 

Brooks

0 Kudos
Reply