I imported the data from an excel sheet as categorical array. It was somewhat manual to work to create my table
Yes, you made a complete mess of it. And you would be better off asking a new question on how to import the data correctly in the first place, rather than attempting to fix the mess afterward.
All the table variables are indeed categorical. Some of the categories have the quote ' embedded in the category (that is the ' you see when looking at the table is not the ' that matlab typically surround char arrays with, it's actual part of the data), others do not.
The simplest way to fix the mess after the fact:
join(erase(string(Exampletable{:, :}), "'"), '', 2)
which:
- extracts the content of the table as a categorical array
- converts the categorical array into a string array
- erases the ' from the string array
- joins the string array across the column
But again, a better approach would be to import the data correctly in the first place, so ask a new question.
6 Comments
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732841
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732841
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732846
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732846
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732906
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732906
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732907
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732907
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732916
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732916
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732928
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/475286-how-can-i-convert-table-of-chars-to-array-of-strings#comment_732928
Sign in to comment.