Custom Functions > Structure Definitions > COMPLEXARRAY Structure
COMPLEXARRAY Structure
Array and vector values in custom functions are passed as COMPLEXARRAY structures. The COMPLEXARRAY structure includes the following four members:
Array->rows, the number of rows
Array->cols, the number of columns
Array->hReal[col][row], the real part of the array values
Array->hImag[col][row], the imaginary part of the array values
When PTC Mathcad sends an array to a custom function using the COMPLEXARRAY structure, it actually passes two arrays: one for the real part and one for the complex part. If no element of an array has an imaginary part, Array->hImag is equal to NULL. If all elements are purely imaginary, Array->hReal is equal to NULL.
There are provisions made for matrices that contain non-numeric values, such as PTC Mathcad string variables. Every entry in these arrays contains either a valid scalar number or a NaN.
PTC Mathcad stores the values of any non-numeric matrix entries in a separate data structure that is not available to the custom function, so it is not possible for the custom function to determine the actual value of the string or function stored. You can pass strings individually using the MCSTRING type.
If the result of your function is a COMPLEXARRAY structure, allocate memory for the complex array using the MathcadArrayAllocate function.
Was this helpful?