Converting cell with numerical and categorical values to matrix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting cell with numerical and categorical values to matrix

Spenduelar
Hi

I am reading a csv file which contains categorical and numerical values using csv2cell function. This obviously come out as a cell array. I would like to convert this cell array to matrix but I am struggling. I have tried cell2mat but it is not working.

Please assist. Thank you 


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Converting cell with numerical and categorical values to matrix

PhilipNienhuis
Spenduelar wrote
> Hi
>
> I am reading a csv file which contains categorical and numerical values
> using csv2cell function. This obviously come out as a cell array. I would
> like to convert this cell array to matrix but I am struggling. I have
> tried
> cell2mat but it is not working.
>
> Please assist. Thank you

You mean the cell array you have contains a mix of numerical and string
values?
In that case you can try to split it into a cellstr array and a numerical
array by parsecell.m in the io package.

Philip



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------