MATLAB: Does a table created using readtable have text values delimited by single quote where as table created using import have text values delimited by double quote

MATLABtable

I have table UnitedNations created by opening UnitedNations.xlsx and selecting Import Selecton.
I also have table un created by
un = readtable("UnitedNations.xlsx")
Why is the first column in the UnitedNations variable delimited by double quotes when the first column in the un variable is delimited by single quotes?

Best Answer

There is no special reason other than it was chosen by Mathworks. In MATLAB, text can be loaded in two ways: char array (single quotes) and string (double quotes). They are distinct data types. Strings were introduced much later, so for a long time, char was the only datatype for text. Now, strings are also being supported for almost all the functions that a char array can do. You can get both behaviors from the import tool and the readable.
In import tool, click the "Text option" in the toolbar, and it will give to option to import in either format. String is the default option, therefore, you get double-quotes.
In readtable() you can also use 'TextType' option to get data in either format.
un = readtable("UnitedNations.xlsx", 'TextType', 'string')