Write large matrix to Excel

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?


1 Answer


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:

   #define USECOMEXCEL 1

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.

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy