Based on the definition of the CSV format, fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes.
In order to write the original table to CSV format, you can add the "QuoteStrings" flag to "writetable". The flag is documented at the link below:
This is illustrated as follows:
>> writetable(DataTable, 'DataTable.csv','QuoteStrings',true);
Then, when reading from the CSV, you should explicitly tell "readtable" the format of the file. This option's workflow is documented at the link below:
This is illustrated as follows:
>> opts = detectImportOptions('DataTable.csv');
>> T = readtable('DataTable.csv',opts)
Best Answer