Add Chars to a Cell Array with numbers
8 views (last 30 days)
Show older comments
Hi!
I want to add an char cell array (Dates in a special format) to an existing cell aray with numbers (measured values)
The Result should look like this: {DATE,DOUBLE,DOUBLE}.
01.01.2012 00:00 4.0639 1.3358
01.01.2012 00:15 3.7716 1.2397
01.01.2012 00:30 3.4936 1.1483
01.01.2012 00:45 3.2258 1.0603
The only succesfull way to bring the data in this format was to use loops but the computation time is here about 50 secs ( and i have to this computation about 800 times for different values and so on). Later this values will be written in an Textfile via dlmcell and should be used as calculation parameter for another software tool(which can only read this form of date ).
Any Ideas?
Thank you,
greetings db
0 Comments
Answers (1)
Azzi Abdelmalek
on 2 May 2013
Edited: Azzi Abdelmalek
on 2 May 2013
A={'01.01.2012 00:00'
'01.01.2012 00:15'
'01.01.2012 00:30'
'01.01.2012 00:45'}
B=[4.0639 1.3358
3.7716 1.2397
3.4936 1.1483
3.2258 1.0603]
out=[A num2cell(B)]
Example:
date1=datenum('01.01.2012 00:00','dd.mm.yyyy HH:MM')
date2=datenum('01.01.2012 00:09','dd.mm.yyyy HH:MM')
dates=datestr(date1:1/(24*60):date2,'dd.mm.yyyy HH:MM')
data=rand(10,2)
out=[cellstr(dates) num2cell(data)]
See Also
Categories
Find more on Downloads 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!