Error with xlswrite in Matlab 2016

Asked

Viewed 123 times

0

I am having problems saving Matlab data in Excel spreadsheets.

I took a very simple example code:

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

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

But it doesn’t work. The error that appears is:

message = 

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

I have Office 2016 working perfectly and with Matlab 2016a. I already disabled the Excel add-ins, ran as Adm, created a spreadsheet to see if it would at least update and nothing.

Does anyone know what might be going on?

1 answer

0

I ran the same code with Matlab R2015a and Office 365 installed. The error message was a little 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’ve had other problems when I needed to use Matlab to export data to other proprietary software. In this case, I usually choose to save on CSV and avoid too much headache.

An alternative solution to this case of yours would be to pass first to dataset and then save in spreadsheet format. Follow the code that works here (except for the additional header that needs to be deleted manually).

A = [1:257;1:257];
ds = mat2dataset(A);
export(ds,'XLSFile','A_dataSet.xlsx')
  • I tested your code and gave the following errors:

  • Error using dataset/export>writeXLSFile/writeXLSVars (line 420) Error writing dataset variable 'A10' to 'A_dataset.xlsx': Error: Unspecified error

  • Error in dataset/export>writeXLSFile (line 409) writeXLSVars();

  • Error in dataset/export (line 112) writeXLSFile(a,xlsfileArg,writevarnames,writeobsnames,otherArgs{:});

  • Error in Test (line 3) export(ds,'Xlsfile','A_dataset.xlsx')

  • I repeated on another computer, same installation characteristics mentioned (Matlab R2015a and Office 365). The output file "A_dataset.xlsx" occurred ok. No help from mat2datset has an alert: "The dataset data type Might be Removed in a Future release.". I do not believe this is the case for your version. Anyway, try running the help example export and see if at least this one works.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.