Matlab Excel COM API using actxserver causing "Invoke Error, Dispatch Exception: Type mismatch."

조회 수: 7 (최근 30일)
Hello. I am trying to put a matrix of 605601 x 1055 double into excel using the COM API using this line:
eSh.Range('A9:ANO605609').Value = t;
where, eSh is the Excel Workbook Activesheet, and t is the matrix I'm trying to put into Excel.
However, the command above give me the error: "Invoke Error, Dispatch Exception: Type mismatch."
any comments or suggestions are appreciated.
Thanks.

답변 (1개)

Sangeetha Jayaprakash
Sangeetha Jayaprakash 2016년 11월 1일
You seem to be encountering this error when you are trying to write data to an Excel file using "actxserver" from MATLAB. Some possible scenarios in which this error can occur are:
  1. This error may occur if a file with macros is saved in Excel 2003 and then used with Excel 2007 or Excel 2010. If this is the case, try opening the file with Excel 2007 or 2010 and re-saving it.
  2. This could be due to a limitation on the amount of data you can pass through the COM object to Excel.As a workaround you can try to write data into Excel in blocks until all of the data has been written to the file.
  댓글 수: 1
Quy Phan
Quy Phan 2016년 11월 1일
It seems the error is from the matrix being too large. I tried writing in blocks and it works. Any idea what the limit is to write in Excel using the COM API?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Use COM Objects in MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by