Add Chars to a Cell Array with numbers

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

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 2일
편집: Azzi Abdelmalek 2013년 5월 2일

0 개 추천

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)]

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

제품

질문:

2013년 5월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by