From: foehner on
Hi,

i have a calculation looking as follows

date_old = data_all.data(:,1);

datebeg = sdate2YYYYMMDDhhmm(ceil(date_old(1)*24)/24); % - round to one hour
dateend = sdate2YYYYMMDDhhmm(ceil(date_old(end)*24)/24); % - round to one hour
date_new = datevectorYYYYMMDDhhmm(datebeg,dateend,AvgInt);

date_old looks like

7.340469652777777
7.340469722222222
7.340469791666666
7.340469861111111
7.340469930555555
7.340470000000000

and so on...

and date_new looks like

2.009093019000000
2.009093020000000
2.009093021000000
2.009093022000000
2.009093023000000
2.009100100000000

(where the last value e.g. says 1.10.2009
in the shape of YYYYMMDD)

and so on...

Now i make

newdata = NaN*ones(size(date_new,1),size(data_all.data,2));
newdata(:,1) = date_new;

date_new becomes my run variable which must be integer in the following output/input function (where date_new and date_old are both inputs)

I already found out that the matlab terror tolds me that the value date_new has to be integer.

However, date_new seems to be non-integer despite the ceil-order.

date_new should be integer value looking like 200910010000 to be used as a run variable and not 2.009100100000

How to manage that?

Thx

foehner
From: foehner on
the error already exists with datebeg between these two steps:

date_old = data_all.data(:,1); % 10min values

datebeg = sdate2YYYYMMDDhhmm(ceil(date_old(1)*24)/24);

whereby sdate2YYYYMMDDhhmm looks as follows

[YYYY,MM,DD,hh,mm,ss] = datevec(sdate);
sdate(find(ss >= 30)) = sdate(find(ss >= 30)) + 1/1440; % add one minute to round to full minutes if necessary
[YYYY,MM,DD,hh,mm,ss] = datevec(sdate) ;
YYYYMMDDhhmm = YYYY*1E8 + MM*1E6 + DD*1E4 + hh*1E2 + mm;

output should be an integer date vector