How do I extract numbers from a textscan?

I need to read a file with lines of data in the following format:
15:52:35.375,0.000,0.606,-0.820,-1,31.400,0.000,0
I am using textscan as follows to parse the data:
C = textscan(A, '%d:%d:%f,%f,%f,%f,%d,%f,%f,%d');
My results look like:
[15] [52] [35.375] [0.000] [0.606] [-0.820] [-1] [31.400] [0.000] [0]
I'm interpreting this output to mean that C is a vector of vectors. Is that correct? How do I convert it to a vector of numbers?

 Accepted Answer

c is a cell array. convert it to double
c=cell2mat(c)
look at
help cell

1 Comment

Thank you. That worked, except that I cannot convert the entire row at once because I have mixed number types.

Sign in to comment.

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!