Will upgrading Matlab or Excel fix this problem?

5 views (last 30 days)
I have some code which reads .xlsx (Microsoft Excel) files. It works on a PC with Matlab R2012a. I don't know what version of Excel that machine has.
I brought the code to my machine. I am using Matlab R2009a and MS Excel 2002 (which might even be corrupt). When I run the code on my machine, I was getting an xlsread error which said the .xlsx file was not MS Excel format (I no longer have the exact error message).
I thought the problem might be my outdated Excel application, so I installed the Excel viewer. But now when I run the code I get repeated errors "Undefined function or method 'isappdaclearta' for input arguments of type 'double'" from "gui_mainfcn" (part of Matlab). I tried uninstalling the viewer, and I still get that error.
I cannot find any function named 'isappdaclearta' and a web search of that name did not produce anything either.
Questions: 1) Does the version of Excel matter to the xlsread() or gui_mainfcn() routines? 2) Will upgrading my Matlab likely fix these errors? 3) What could be wrong? (And how do I fix it?)
Answer was a combination of the two answers below. I needed a new Excel version (or possibly the Excel viewer) and I corrupted the Matlab toolbox file gui_mainfcn.m. Not sure who to credit.

Accepted Answer

Sean de Wolski
Sean de Wolski on 20 Nov 2013
XLSREAD calls the Excel COM api to open the file. If the 2002 version of Excel does not support *.xlsx, which a quick search indicates it does not, then you'll need a newer version of Excel. Alternatively, you could export the *.xlsx file as a *.csv and then read it in with csvread.
  5 Comments
Jeff
Jeff on 21 Nov 2013
Installing Excel did not fix the "undefined 'isappdaclearta'" message.
Sean de Wolski
Sean de Wolski on 21 Nov 2013
That error message is likely due to you accidentally typing "clear" in the middle of "isappdata".
Run the following and then run your file:
dbstop if error
Then Run you file. It'll stop on this line and you can remove the "clear" and save/exit/rerun.

Sign in to comment.

More Answers (2)

Image Analyst
Image Analyst on 21 Nov 2013
Edited: Image Analyst on 21 Nov 2013
A viewer is a simple program that lets people just barely get by and view the file. I'm pretty sure that a viewer will not allow ActiveX control of it. MATLAB is still trying to write the xlsx file with your old version of Excel via ActiveX, not via the viewer since the viewer doesn't work with ActiveX. Thus, despite installing the viewer, it still won't work.
If you have the m-file source code you can instruct ActiveX to use the old format. See this snippet and incorporate it into your code accordingly:
% Prepare proper filename extension.
% Get the Excel version because if it's version 11 (Excel 2003) the file extension should be .xls,
% but if it's 12.0 (Excel 2007) then we'll need to use an extension of .xlsx to avoid nag messages.
excelVersion = str2double(Excel.Version);
if excelVersion < 12
excelExtension = '.xls';
else
excelExtension = '.xlsx';
end
% Determine the proper format to save the files in. It depends on the extension (Excel version).
switch excelExtension
case '.xls' %xlExcel8 or xlWorkbookNormal
xlFormat = -4143;
case '.xlsb' %xlExcel12
xlFormat = 50;
case '.xlsx' %xlOpenXMLWorkbook
xlFormat = 51;
case '.xlsm' %xlOpenXMLWorkbookMacroEnabled
xlFormat = 52;
otherwise
xlFormat = -4143;
end
% Add a new workbook.
ExcelWorkbook = Excel.workbooks.Add;
% Save this workbook we just created.
ExcelWorkbook.SaveAs(excelFullFileName, xlFormat);
  1 Comment
Jeff
Jeff on 21 Nov 2013
Installing a new Excel did not work. I don't know where to put this code. The function giving the error is a standard Matlab library.

Sign in to comment.


Iain
Iain on 21 Nov 2013
Edited: Iain on 21 Nov 2013
'isappdaclearta'?
Ok. That looks like 'isappdata', but that you've tried debugging, typed clear, wondered where the mouse was, went to the command line, typed clear, and closed everything down, saving the now screwed up isappda - clear - ta
I suggest you try removing the "clear" from that line of code...
The latest version of excel has no problem using xlsread to read .xlsx files.
  3 Comments
Jeff
Jeff on 21 Nov 2013
Edited: Jeff on 21 Nov 2013
But I tried what you suggested, anyway. I changed the line from "isappdaclearta" to "isappdata", and now it works. Interestingly, when I saved the file, Windoze did not change the 'Date Modified' field.
I suspect that the Excel Viewer would have worked if I hadn't had this 'isappdaclearta' line. No matter - it is now solved.
More important question (probably for another thread): How can I know if I've corrupted other core Matlab files?
Image Analyst
Image Analyst on 21 Nov 2013
Looks like lain nailed it. Go ahead and mark his answer "Accepted".

Sign in to comment.

Tags

Products

Community Treasure Hunt

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

Start Hunting!