convert Cell to double
10 views (last 30 days)
Show older comments
Hi,
I have C{1,1}<1500x1 cell> which contains data like:
'10/21/2013 13:11:34.0289993'
'10/21/2013 13:11:34.1289978'
'10/21/2013 13:11:34.2289962'
'10/21/2013 13:11:34.3290023'
'10/21/2013 13:11:34.4290008'
'10/21/2013 13:11:34.5289993'
'10/21/2013 13:11:34.6289978'
'10/21/2013 13:11:34.7289962'
I need to convert this cell to double,I used:
C =cellfun(@str2double,C,'un',0);
but it replaces all data with NaN !
can someone help me with that?
best, Navid
0 Comments
Answers (1)
Azzi Abdelmalek
on 12 Apr 2014
Edited: Azzi Abdelmalek
on 12 Apr 2014
D={'10/21/2013 13:11:34.0289993'
'10/21/2013 13:11:34.1289978'
'10/21/2013 13:11:34.2289962'
'10/21/2013 13:11:34.3290023'
'10/21/2013 13:11:34.4290008'
'10/21/2013 13:11:34.5289993'
'10/21/2013 13:11:34.6289978'
'10/21/2013 13:11:34.7289962'}
s=regexp(D,'\.','split')
a=cellfun(@(x) x{1},s,'un',0)
b=cellfun(@(x) x{2},s,'un',0)
6 Comments
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!