Re: using print statement to print to memory or a variable? [message #81108] |
Thu, 16 August 2012 14:20 |
DavidF[1]
Messages: 94 Registered: April 2012
|
Member |
|
|
Mark writes:
> I suspect that's what I'll have to wind up doing. The code kicks out about 100 printf outputs, all different depending on the inputs, and sometimes I'll need things to just print to a file or screen, but sometimes it would be nice to have a character string kicked out for a title, say...
It might take 30 seconds to write a wrapper that could do this.
Cheers,
David
|
|
|
Re: using print statement to print to memory or a variable? [message #81110 is a reply to message #81108] |
Thu, 16 August 2012 14:03  |
astroboy.20000
Messages: 39 Registered: August 2012
|
Member |
|
|
>
> STRING and PRINT/PRINTF take arguments and format strings in the same
>
> manner, so it's not hard to change between them, i.e.,
>
>
>
> printf, lun, a, b, c, format=format_string
>
>
>
> or
>
>
>
> s = string(a, b, c, format=format_string)
>
>
>
> Mike
>
> --
>
> Michael Galloy
>
> www.michaelgalloy.com
>
> Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
>
> Research Mathematician
>
> Tech-X Corporation
Thanks Mike,
I suspect that's what I'll have to wind up doing. The code kicks out about 100 printf outputs, all different depending on the inputs, and sometimes I'll need things to just print to a file or screen, but sometimes it would be nice to have a character string kicked out for a title, say...
|
|
|
Re: using print statement to print to memory or a variable? [message #81111 is a reply to message #81110] |
Thu, 16 August 2012 13:24  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 8/16/12 2:03 PM, Mark Q wrote:
> Pardon me if this is general knowledge, but I'm trying to figure out if it's possible to use a print statement to print to a plot, so to speak.
>
> The basic idea is this. I have some complicated code which eventually contains a line:
>
> printf,lun,"some format here", var1,var2,var3
>
> which prints to the screen or a file.
>
> As I recall, in fortran it's possible to print to memory (or print to a variable), and then to read that string from memory, which I could then send to a plot. For obnoxious reasons, I'd rather do this than rewrite the code to actually generate a character string...
>
> Thanks,
>
> Mark
>
STRING and PRINT/PRINTF take arguments and format strings in the same
manner, so it's not hard to change between them, i.e.,
printf, lun, a, b, c, format=format_string
or
s = string(a, b, c, format=format_string)
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
|
|
|