MATLAB Answers


Convert cell array to vector

Asked by John
on 13 Feb 2012
Latest activity Edited by a
on 12 Oct 2013

Hi there,

I have imported time values (i.e 12:57:00) into matlab using the textscan() function.

fid = fopen('time.txt','r') 
out = textscan(fid,'%s') 

However the values are in a cell array, I think?

How can I convert them to a vector? I need to do this because I want to import the data into the dfitool.

Thank you



No products are associated with this question.

1 Answer

Answer by Jan Simon
on 13 Feb 2012
 Accepted answer

I assume you want a datenum vector:

d = datenum(out{1});

If not, please explain the wanted output format.

  1 Comment

on 14 Feb 2012

Many thanks Jan

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!