3.5.2.3.26 Real2Complex

Description

This function is used to convert the specified two reals into a complex number.

Note that the output for this function are complex values, so when doing calculation on data columns, you need to set column data type to complex prior to set column formula. For details, see the example section below.

Syntax

complex Real2Complex(double d1, double d2)

Parameters

d1

The real number for the real part of complex.

d2

The real number for the imaginary part of complex.

Return

Return a complex number.

Example

complex c = real2complex(1, 2);
c = ;  // c=1+2i
// Set data type of column C to complex 16 in advance
wks.col3.numerictype = 11;

// Generate a set of complex numbers and put to column C
col(C) = real2complex(col(A), col(B));

See Also

ImReal, Imaginary