cellmatrix & xlw 5.0

For discussion of the xlw project for producing xlls.

cellmatrix & xlw 5.0

Postby mesons » Tue Apr 16, 2013 8:41 pm

Dear forum,

It seems that in the cellmatrix doesn't work in xlw5.O. The code is compiled and the xll is generated, but when run the function I have the following error :
invalid vector<T> subscript


Here is the code :

CellMatrix // Get elements from the Day Counter map
CF_GetMapKeys()
{

std::vector<std::string> Keys;
Keys=GetMapKeys(); // This function returns a vector of string
int KeySize = Keys.size();
CellMatrix res(KeySize,0);
for(int i=1;i<=KeySize;i++){
res(i,0)=Keys[i];
}
return res;
}

I tried to replace the line res(i,0)=Keys[i]; by res(i,0)=1.0; but even in this case I have the error.

Could someone help me ?

Thanks in advance
best regards,
mesons
 
Posts: 3
Joined: Mon Apr 15, 2013 10:17 am

Re: cellmatrix & xlw 5.0

Postby mj » Wed Apr 17, 2013 10:50 am

have you tried converting the string to CellValue before the assignment to the CellMatrix?
mj
Site Admin
 
Posts: 1380
Joined: Fri Jul 27, 2007 7:21 am

Re: cellmatrix & xlw 5.0

Postby bnj » Mon Nov 04, 2013 10:43 am

Hi,
Maybe you should declare CellMatrix res(KeySize,1); and not CellMatrix res(KeySize,0);
Furthermore the index goes from 0 to KeySize-1 in a KeySize size array in C an C++
bnj
 
Posts: 1
Joined: Mon Nov 04, 2013 10:39 am


Return to xlw

Who is online

Users browsing this forum: No registered users and 1 guest

cron