Resources

Write large matrix to Excel

0

I would like to write a large matrix from GAUSS into Excel.

I can do this if the matrix is not to large using the following code:

xlswritem(y, "y.xlsx", "a2", 1, "");

where y is the name of the matrix (a 100 by 600 matrix) in GAUSS and the excel filename is y.xlsx.

If I increase the columns of y it does not work anymore.. So I cannot write a 600 by 1000 matrix into excel.

How can I make it work?

Cheers

Tags: asked October 18, 2013

1 Answer

0

Recent versions of GAUSS should have no limitation on the size of matrix you read and write from an Excel file other than those imposed by Excel. Here is a test example that should work as a test:

x = rndn(600, 1000);
ret = xlsWriteM(x,"y.xlsx", "A2", 1, "");
z = xlsReadM("y.xlsx", "A2", 1, "");

print "rows of z = " z;
print "cols of z = " z;

After this snipped, z should have the same contents as the original x. If this does not work, it is most likely because you have an older version of GAUSS (probably older than version 10) or you have an older version of Excel installed on your machine.

If you have GAUSS 13 or GAUSS 14 you can comment out these lines towards the top of your xls.src file:

#ifOS2WIN
   #define USECOMEXCEL 1
#endif

The xls.src file is located in your /src directory.

Commenting out those lines will cause GAUSS to directly read and write Excel files rather than interfacing with the Excel application which will remove that as a possible problem.

Let me know if this is does not solve your problem.

aptech
342