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

1 件のコメント

Domenik
Domenik 2013 年 5 月 6 日
Thank you! Works perfect!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDates 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