Error using writetable - all columns get concatenated into a single one

Hi all!
I experience difficulties when I try to write my table back to an Excel File.
It seems to write all columns into the first column and I have no idea why.
I've already searched the internet and haven't found any similar problem so maybe you can advise me.
writetable(new_table,'C:\Users\Heindl\something\somethingelse.xls');
% This is the error:
Error using writetable (line 142)
Unable to write to sheet 'Sheet1' in file 'C:\Users\Heindl\something\somethingelse.xls'. Disable sheet protection, disable workbook's Mark as Final option, and ensure input does not exceed cell capacity.
Error in write_in_something (line 159)
writetable(new_table,'C:\Users\Heindl\something\somethingelse.xls');
The table in Matlab is around 100 by 100 but after writing it becomes a single 100 by 1 column. I am not allowed to post the table since it contains restricted research data, I'm sorry.
I should add, that I have already deleted additional 'iscategorical.m' files, which sometimes seems to help others with kind of similar problems.
Matthias

4 Comments

What you show is an error thrown by writetable, which would mean that nothing gets written. So it's not clear why you say that something gets written.
I have already deleted additional 'iscategorical.m' files
Hopefully, you haven't deleted matlab's own iscategorical.m. If you have, I'm afraid you'll have to reinstall. Do not mess with matlab own files.
You are right, if I try to write an Excel file, there appears nothing but the shown error. However if I write the table to a csv file, it works but with the previously shown issue.
I tried to rewrite it and got this orange warning:
Warning: Variable names were modified to make them valid MATLAB identifiers.
The original names are saved in the VariableDescriptions property.
I've not deleted Matlabs own iscategorical.m file, only the iscategorical.m files from a toolbox.
Now, this is very confusing. How can a csv file (text file) have everything in one column?
In any case, best way for us to understand the problem is:
  • a mat file containing the table (or a short version of it) you want to write
  • the exact code you use to write it to a file.
With regards to the toolbox, you may be better off uninstalling it completely since it's probably broken without its own iscategorical.
I was having this issue as well. All columns were concatenated to a single column. Odly enough, if I only wrote certain subsections of the table to csv it worked fine. 7:1000 worked, but 6:1000 didn't work. 1:10 worked fine. I thought maybe it was a size of data, but could never find a discernable pattern. 7:2000 was fine as well.

Sign in to comment.

Answers (0)

Categories

Products

Asked:

on 12 Aug 2019

Commented:

on 31 Aug 2021

Community Treasure Hunt

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

Start Hunting!