strtofcplx#

Purpose#

Converts a string array to a complex numeric matrix.

Format#

x = strtofcplx(sa)#
Parameters:

sa (NxK string array) – numeric data

Returns:

x (NxK complex matrix) – complex numeric matrix created from contents in sa;

Remarks#

strtofcplx() supports both real and complex data. It is slower than strtof() for real matrices. strtofcplx() requires the presence of the real part. The imaginary part can be absent.

Examples#

// Spaces required around + and -
string sa = { "3 + 2i" "1 - 4i" };

x = strtofcplx(sa);
print x;

The code above produces the following output:

3.0000000 + 2.0000000i       1.0000000 - 4.0000000i

See also

Functions strtof(), ftostrC()