I want data like this
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dates Data
01-06-2014 2.088583333
02-06-2014 NaN
03-06-2014 2.264222222
04-06-2014 2.530666667
05-06-2014 2.494333333
06-06-2014 NaN
07-06-2014 2.429666667
08-06-2014 2.3515
09-06-2014 NaN
10-06-2014 3.879833333
11-06-2014 5.84
12-06-2014 NaN
13-06-2014 NaN
14-06-2014 3.177583333
15-06-2014 NaN
16-06-2014 3.523666667
17-06-2014 3.198416667
18-06-2014 2.109083333
19-06-2014 NaN
20-06-2014 1.520833333
21-06-2014 1.269666667
22-06-2014 NaN
23-06-2014 1.125583333
24-06-2014 1.076666667
25-06-2014 1.071333333
26-06-2014 1.029166667
27-06-2014 1.121333333
28-06-2014 NaN
29-06-2014 1.06175
30-06-2014 1.083
01-07-2014 1.273666667
02-07-2014 1.32975
03-07-2014 0.875640097
04-07-2014 NaN
05-07-2014 0.771616244
06-07-2014 0.667592391
07-07-2014 NaN
08-07-2014 0.563568539
I want data like this
Date Data
01-06-2014 2.088583333
02-06-2014 NaN
03-06-2014 2.264222222
04-06-2014 2.530666667
05-06-2014 2.494333333
06-06-2014 NaN
07-06-2014 2.429666667
08-06-2014 2.3515
09-06-2014 NaN
10-06-2014 3.879833333
11-06-2014 5.84
12-06-2014 NaN
13-06-2014 NaN
14-06-2014 3.177583333
15-06-2014 NaN
16-06-2014 3.523666667
17-06-2014 3.198416667
18-06-2014 2.109083333
19-06-2014 NaN
20-06-2014 1.520833333
21-06-2014 1.269666667
22-06-2014 NaN
23-06-2014 1.125583333
24-06-2014 1.076666667
25-06-2014 1.071333333
26-06-2014 1.029166667
27-06-2014 1.121333333
28-06-2014 NaN
29-06-2014 1.06175
30-06-2014 1.083
01-07-2014 1.273666667
02-07-2014 1.32975
03-07-2014 0.875640097
04-07-2014 NaN
05-07-2014 0.771616244
06-07-2014 0.667592391
07-07-2014 NaN
08-07-2014 0.563568539
1 commentaire
Réponses (8)
Stalin Samuel
le 12 Oct 2015
d1 = datenum('01 June 2014');%starting date
d2 = datenum('08 July 2014');%End date
dates = d1:d2;%Dates from starting to end
s = numel(dates);%Total no of days
data = rand(s,1);% your data
tsobj = fints(dates', data, {'data'},'Daily','')%creating time series
0 commentaires
Walter Roberson
le 12 Oct 2015
Provided that your dates are a cell array of strings, then
dv = datevec(dates);
what_you_want = dv(:,3);
1 commentaire
Stalin Samuel
le 12 Oct 2015
Modifié(e) : Stalin Samuel
le 12 Oct 2015
d1 = datenum('01 June 2014');
d2 = datenum('01 June 2024');
dates = d1:d2;
ur_days = day(dates');
0 commentaires
lokeswara reddy
le 12 Oct 2015
1 commentaire
Walter Roberson
le 12 Oct 2015
You have changed your requirements too many times; I have dropped out of the discussion.
Stalin Samuel
le 12 Oct 2015
[num,txt,raw] = xlsread('date_1.xls');
req = raw(3:24,1:2); %selsect process data date and data
req1 = cell2mat(raw(3:24,2)) %Only data
d1 = datenum(req(:,1),'dd-mm-yyyy')%only date
tmp = d1(1):d1(end);%Total dates
isSubset =ismember(tmp,d1); %find missing date
m = 1;
for i = 1:numel(tmp)
if isSubset(i)==1 %for actual dates and data
data(i,:) =(tmp(i));
val(i) = req1(m);
else %for mssing dates and data
data(i,:) =tmp(i);
val(i) = 0;
end
end
result = fints(data,val')
%Unable to add NaN....
Voir également
Catégories
En savoir plus sur Dates and Time dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!