MATLAB Answers


" Error using readtable (line 198) An internal error occurred ". How can I solve this issue?

Asked by DanRB
on 23 May 2018
Latest activity Answered by Mahboubeh Habibi on 23 Feb 2019
I am trying to load data stored in an Excel file (.xlsx) into MATLAB R2017a using readtable as in the following code:
data = readtable('Nuevo.xlsx');
However, when I run the command the following error message appears: " Error using readtable (line 198) An internal error occurred." I have tried to solve the issue providing the full path of the file but it also doesn't work. Can you please help me to find a solution?


Are you using MS Windows with excel installed?
My machine actually doesn't have Office installed and it still works.
In my case, yes Excel is installed and I am a Windows user. Should I suspect that that is the problem?

Sign in to comment.





3 Answers

Answer by Walter Roberson
on 24 May 2018
 Accepted Answer

readtable talks to excel on Windows with Excel installed, and on other systems uses internal routines. I am using Mac, which never talks to Excel; on my system, readtable() is happy with the file in R2016a,R2017a, R2018a (I did not try other versions.)
I suggest you experiment with
[num, txt, raw] = xlsread('Nuevo.xlsx');
I speculate that you will see an error message about an exception with a hex code that starts 0xC000 something. If so then that could suggest that you might have an Excel add-in such as FoxIt that is causing problems.
If you do see an error message with xlsread() then try
[num, txt, raw] = xlsread('Nuevo.xlsx', 1, '', 'basic');
That will force it to use the internal routines. When you do that then the dates you get back in the first column will be numeric and will be Excel date numbering system; you can convert to more readable form using datetime() with the option 'convertfrom', 'excel':
>> datetime(17533,'convertfrom','excel')
ans =
01-Jan-1948 00:00:00

  1 Comment

Your first suggestion works pretty well. Thank you very much!

Sign in to comment.

Answer by Jeremy Hughes on 24 May 2018

I tried,
T = readtable('Nuevo.xlsx')
T = readtable('Nuevo.xlsx','Basic',true)
And both worked for me. Sometimes the Excel install has issues and re-installing Excel or updated Excel may have an effect.
If Basic=true works, and Basic=false does not, that's an indication of a problem with Excel.
HTH, Jeremy

  1 Comment

The second line of code works perfectly. Thanks!

Sign in to comment.

Answer by Mahboubeh Habibi on 23 Feb 2019

When you have a column name in your excel file that contains space or specific characters then you will get the error.


Sign in to comment.