X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 27 Aug 2020 06:40 PM by  Jim Uba
IDL PRINT format code problem
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Jim Uba



New Member


Posts:81
New Member


--
27 Aug 2020 06:40 PM
    Q: Why does the following fail to print as expected

    IDL> a1 = 1
    IDL> a2 = 2
    IDL> a3 = 3
    IDL> print,format='(8a,i02,i08,a3,i02,a4)', "abcdefgh",a1,a2,"ijk",a3,"LMNO.txt"
    abcdefgh 1 2ijk 3LMNO.txt

    I expect output like:

    abcdefgh0100000002ijk03LMNO

    A: The first format code "8a" is not correct for the desired output. "8a" specifies output for 8 strings.

    Instead, the correct format code should be "a8". For example:

    IDL> print,format='(a8,i02,i08,a3,i02,a4)', "abcdefgh",a1,a2,"ijk",a3,"LMNO.txt"
    abcdefgh0100000002ijk03LMNO
    You are not authorized to post a reply.