CopyC++
IMPLEMENT_XLLFN3(TestMatrixAddRow, TestMatrixAddRow_4, TestMatrixAddRow_12,
"RJ", "UJ", L"TestMatrixAddRow", 0, L"RowsToAdd", 0, L"Example", 0, L"Add "
L"a row to a matrix", 0, L"Number of rows to add\0", 0, 0, L"{TestMatrixAd"
L"dRow,,,Add a row to a matrix,Example,1,128,U,{{0,{RowsToAdd,Int,0,,Numbe"
L"r of rows to add,,,,}}},{},3,,0,0}", 1)
CXlOper* TestMatrixAddRow_Impl(CXlOper&, long);
extern "C" __declspec(dllexport)
LPXLOPER12 TestMatrixAddRow_12(long RowsToAdd)
{
XLL_FIX_STATE;
CXlOper xloResult;
try {
CXlStructuredExceptionHandler _seh_;
xloResult.HandleResult(TestMatrixAddRow_Impl(xloResult, RowsToAdd));
}
catch(const CXlRuntimeException& ex) {
CXllApp::Instance()->DisplayException(xloResult, ex);
}
return xloResult.Ret12();
}
extern "C" __declspec(dllexport)
LPXLOPER4 TestMatrixAddRow_4(long RowsToAdd)
{
XLL_FIX_STATE;
CXlOper xloResult;
try {
CXlStructuredExceptionHandler _seh_;
xloResult.HandleResult(TestMatrixAddRow_Impl(xloResult, RowsToAdd));
}
catch(const CXlRuntimeException& ex) {
CXllApp::Instance()->DisplayException(xloResult, ex);
}
return xloResult.Ret4();
}
CXlOper* TestMatrixAddRow_Impl(CXlOper& xloResult, long RowsToAdd)
{
if ( RowsToAdd <= 0 )
xloResult = xlerrNA;
else
{
xlp::matrix<double> mat;
mat.resize(0, 3);
double adNew[3] = { 1.0, 2.0, 3.0 };
for ( long i = 0; i < RowsToAdd; i++ )
mat.add_row(adNew);
xloResult = mat;
}
return xloResult.Ret();
}
Uses
matrix<T>::add_row