Reads a row or a column from an array into a vector of numbers
[C++]
BOOL ReadVector(
std::vector<double>& dvec,
const char* pszArgName,
CString& strError = 0,
long* plUBound = 0,
long lRowOrCol = XLA_UNIQUE_VECTOR,
long lFlags = XLA_ARRAY_FLAGS_STD,
long lLBound = 0,
long lIgnoreItems = 0
) const;
BOOL ReadVector(
std::vector<double>& dvec,
const char* pszArgName,
CXlOper& xloError,
long* plUBound = 0,
long lRowOrCol = XLA_UNIQUE_VECTOR,
long lFlags = XLA_ARRAY_FLAGS_STD,
long lLBound = 0,
long lIgnoreItems = 0
) const;
A vector of double, whose contents will be replaced by the contents of the OPER array.
The name of the argument that is being read. This will be used in any error strings that are generated.
Reference to an error string buffer. If the function fails for any reason, a useful error string will be placed here, e.g. "MyArgName: expected number in cell 3".
Pointer to upper bound. If it is null, then it is ignored. If it is not null then it is used to check that the upper bounds of various arrays are consistent. The value of the bound should be set to -1 before it is used.
If the value is found to be -1, then it will be set to the upper bound of the vector being read (i.e. the first vector that uses this bound). Thereafter (i.e. on all vectors that use this bound, other than the first) the value will be compared against the upper bound of the vector being read. If the two bounds are not identical, then an error will be reported and the function will return FALSE.
Depending on value of the XLA_BOUND_MASK bit of lFlags, the upper bound will be set either to the index of the last member of the array (XLA_BOUND_UBOUND_INNER) or the index + 1 (XLA_BOUND_UBOUND_OUTER).
Zero-based index of row or column to be extracted. If it is out of range, the function will fail.
If lRowOrCol is set to XLA_UNIQUE_VECTOR, then the only row of a single-row array (or the only column of a one-column array) will be returned: if the array has more than one row and more than one column, the function will report an error and return FALSE.
Flags controlling the conversion. See matrix & vector flags for a full list of flag values.
This will be used as a lower bound in the output vector. lLBound cells containing the default value will be inserted at the start of the output vector.
The first lIgnoreItems of input will be ignored. This option can be useful for excluding labels.
If any error occurs, a description will be put into xloError. It can then conveniently be returned as the result of the add-in function.
The function returns TRUE if the conversion was successful,
FALSE if it failed for any reason. If it fails, an explanatory error string will be written
to *psErrorString.
This should be returned to the user, along with the name of the argument that failed.
See the example for more details.
This function extracts a single row of numbers from an array argument.
A wide variety of other options are available, if you use other flag values
and optional arguments.
See matrix & vector flags for a full list of flag values.
Header: xllplus.h