Resources

Error when trying to export matrix to excel: Could not access specified range in file

0

I am using Gauss 14 and attempting to export a large matrix to excel using the following:

vls = reshape(error(0),9,1);

ret = xlsWrite(results, "a.xlsx", "A1", 1, vls);

where results is a matrix approximately 570000x6. I keep getting the error message "Could not access specified range in file: a.xlsx" Could someone please tell me how to fix this problem? Thanks

Tags: asked August 12, 2014

3 Answers

0

It may be that the standard COM interface between GAUSS and Excel on Windows cannot handle 570,000 rows. GAUSS 13 and newer also comes with the capability to read and write XLS and XLSX files directly. This method can write that many rows.

To turn off the COM interface and have GAUSS read and write XLS/XLSX files directly you need to comment out three lines inside of your xls.src file. You can open this file by entering:

edit xls.src;

from the GAUSS command prompt. GAUSS will know which directory to look in. You need to comment out these lines:

#ifOS2WIN
   #define USECOMEXCEL 1
#endif

so that they look like this:

Then run your xls.src file, by entering:

run xls.src;

from the GAUSS command line. Then you should be able to read and write any size file that the XLS or XlSX format can handle.

aptech
342
0

Thank you for the response. After doing that, I now get the input message "Incorrect input: range too large." Thoughts?

0

I have it working now. I think your hypothesis about the matrix being too large was correct. Thank you for the help.