Calculating combinations of dates with empty cells
1 view (last 30 days)
I have the following cell vector of dates
jji= ' '
that corresponds to the cell vector of values
and I want to create the following new vector of values
where in the second row of this vector the numerator (28*0.6034+3*0.5943) is the sum of two products.
In the first product which is 28*0.6034 the number 28 is actually the first two digits from '28/12/08'
In the second product which is 3*0.5943 the number 3 is actually the distance in days between 28/12/08' and the end date of that month, that is the difference '28/11/08-31/11/08
The denominator in the second row (31) is the total number of days for month November 2008
Similar analysis holds for the last raw.
In my previous question Andrei gave a very nice code that worked for the case that I do not have empty cells.
[Y M D] = datevec(jji,'dd/mm/yyyy');
ED = eomday(Y, M);
n = numel(values);
out = sum([D, ED-D].*awe,2)./ED;
How could I modify that code for the case of empty cells?