MATLAB Answers

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

70 views (last 30 days)
DanRB on 23 May 2018
Answered: 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?


Show 2 older comments
DanRB on 24 May 2018
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.

Accepted Answer

Walter Roberson
Walter Roberson on 24 May 2018
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

More Answers (2)

Jeremy Hughes
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

Mahboubeh Habibi
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.