Add Chars to a Cell Array with numbers
Mostrar comentarios más antiguos
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
Respuestas (1)
Azzi Abdelmalek
el 2 de Mayo de 2013
Editada: Azzi Abdelmalek
el 2 de Mayo de 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)]
1 comentario
Domenik
el 6 de Mayo de 2013
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!