How to report a matrix back to excel?

Nov 13, 2012 at 3:51 AM

Hi Keith,

Now that I know how to use FP WINAPI to accept data from a range of cells. How do I report back to excel with my matrix so that it shows on a range of cells?



Nov 13, 2012 at 10:17 AM

Let me know if the documentation for the FP data type is not telling you what you want to know.

Nov 21, 2012 at 4:11 PM

Sorry being late, but let's use the unique function on _FP data type pasted below. If the selected range has data {1,2,3,3,4,4,5}, then the out come should be {1,2,3,4,5}. But instead of having the whole return array displayed on excel, I only got the first cell displaying {1}. So how to display the full array back on excel?

_FP* WINAPI xll_array_unique(

const _FP* pa)







xll::FP aa;


// Copy what pa points at to a

aa = *pa;


// STL function to remove duplicates



* pe = std::unique(aa.begin(), aa.end());


// Size of non-duplicates



<WORD>(pe - aa.begin()), 1);





Nov 21, 2012 at 5:05 PM

Google "Excel array function". Or use adjust.xll from

Nov 21, 2012 at 11:17 PM

Ok, I forgot the trick of "Ctrl+Shift+Enter" with a pre-selected range. Now another but related question: How to pass-in two arguments on _FP WINAPI addin? Thanks!

Nov 21, 2012 at 11:45 PM

You should try the adjust.xll add-in. No need to know the size of the output range. It just blams the right size range into the spreadsheet.

You can use _FP* arguments for Excel functions. They are actually the most efficient way of passing large arrays of doubles to the underlying code. Unlike VBA or .Net, your native code gets handed a pointer to Excel memory instead of copying or marshalling the data.