How to go from a char that is a CSV to a cell array
Show older comments
Hello all,
I have a char variable that is essentially a CSV file, however all attempts to turn it into a cell array (through simple means) have failed. Lets say my char variable looks like:
inputchar = 'name,bob,joe,paul
age,12,43,15'
(note there is a \n after paul) I would like my output to simply be a cell array to appear as:
outputcellarray = {'name','bob','joe','paul';
'age',12,43,15}
While I am aware of csvread, since I am trying to read from a char variable instead of a CSV file, I am having trouble. Any suggestions or simple workarounds other than writing an entire function to do this?
Thanks so much for the help everyone! Will
Accepted Answer
More Answers (1)
Will Kinsman
on 1 Mar 2016
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!