writting formatted ascii file [message #36657] |
Thu, 09 October 2003 08:56  |
Francois Leduc
Messages: 5 Registered: October 2003
|
Junior Member |
|
|
Hello,
I have a 13 columns by 5 rows floating that I want to save in a ASCII file.
I can use the following command:
openw, 1, 'd:\file.txt'
printf, 1, FORMAT = '(13(F11.4))', array
close, 1
My question is: How to replace the 13 value by a variable ?
By doing this:
a = 13
printf, 1, FORMAT = '(a(F11.4))', array
I get an error message or the format is not in the proper way.
Thank you very much.
Francois.
|
|
|
Re: writting formatted ascii file [message #37194 is a reply to message #36657] |
Tue, 02 December 2003 05:09  |
Chris[1]
Messages: 23 Registered: January 2003
|
Junior Member |
|
|
use
a = 13
s = '(' + string(a) + '(F11.4))'
printf,1,format=s,array
The format keyword takes a string variable as an argument.
Cheers;
Chris
"Francois Leduc" <francois.leduc@drdc-rddc.gc.ca> wrote in message
news:1065716817.4594@news.drenet.dnd.ca...
> Hello,
>
> I have a 13 columns by 5 rows floating that I want to save in a ASCII
file.
> I can use the following command:
>
> openw, 1, 'd:\file.txt'
> printf, 1, FORMAT = '(13(F11.4))', array
> close, 1
>
> My question is: How to replace the 13 value by a variable ?
>
> By doing this:
> a = 13
> printf, 1, FORMAT = '(a(F11.4))', array
>
> I get an error message or the format is not in the proper way.
>
> Thank you very much.
>
> Francois.
>
>
|
|
|