How to properly import a dataset including characters and numbers?

4 views (last 30 days)
Hello all, I am in the process of importing an xls based data input file. The data has several columns- some of them include an exponential digit, expressed with an "e". A sample of the dataset is shown below:
.49 .159 5.16e-04 7.42e+02 .155
.. etc
I tend to use the "import data" function, and automatically had it generate a script. However, upon seeing the e and + characters, matlab imports that column to be a cell via the cellvectors() command.
As a result I have a combination of data() files and cellvectors() files- with these data types, I unfortunately cannot plot all of the data output together.
Can anybody help me in a way to enable the data importing so it can properly handle exponential files? (Or if there is no other way, is there a way to "convert" the cell file with the characters as a float number that can be plotted with the other number values?)
Thanks in advance for the help.

Accepted Answer

Samuel
Samuel on 2 Feb 2017
Edited: Samuel on 2 Feb 2017
I was able to find the solution- in the import data option, I can click on the column selection and click on the data type it needs to be imported to- for the ones that says "cell", I can make it be a number, and clicking on "apply to selection" applies to every part that needs to be changed.
I am not sure if I am allowed to "accept" my own answer, but Just an fyi to the future people that might be interested. feel free to leave a comment if anybody needs more help.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!