Error with xlswrite in Matlab 2016

0

I'm having trouble saving Matlab data to Excel spreadsheets.

I took a very simple example code:

A = [1:257;1:257];

[status message] = xlswrite('teste.xls', A)

But it does not work. The error that appears is:

message = 

       message: 'Error: Erro não especificado…'
    identifier: 'MATLAB:COM:E0'

I'm running Office 2016 running perfect and with Matlab 2016a. I've disabled Excel add-ons, run as an adm, created a spreadsheet to see if it at least updated and nothing.

Does anyone know what might be happening?

    
asked by anonymous 30.09.2018 / 22:18

1 answer

0

I ran the same code with MatLab R2015a and Office 365 installed. The error message was a bit different and without a quick fix.

status = 
     0
message = 
       message: 'The specified data range is invalid or too large to write
       to the specified file format. Try writing ...' 
    identifier: 'MATLAB:xlswrite:SelectDataRange'

I had other problems when I needed to use MatLab to export data to other proprietary software. In this case, I usually choose to save in CSV and avoid a lot of headaches.

A workaround for this case would be to first go to dataset and then save it in spreadsheet format. Here is the code that works fine (except for the additional header that needs to be manually deleted).

A = [1:257;1:257];
ds = mat2dataset(A);
export(ds,'XLSFile','A_dataSet.xlsx')
    
01.10.2018 / 00:57