View complex numbers in Fortran

When working with complex numbers, you might want to view only the real or imaginary elements of the number. This can be useful when evaluating expressions, or viewing an array in the Multi-Dimensional Array Viewer. See Multi-Dimensional Array Viewer (MDA).

You can use the Fortran intrinsic functions REALPART and AIMAG to get the real or imaginary parts of a number, or their C99 counterparts creal and cimag.

Complex numbers in Fortran can also be accessed as an array, where element 1 is the real part, and element 2 is the imaginary part.

Viewing the Fortran complex number 3+4i