I have a matrix "A" with three columns: daily dates,prices,and hours - all same size vector - there are multiple prices associated to hours in a day.
For each date, hours repeat and I need to interpolate linearly prices that I don't have for some "wanted" hours. But of course I can't use the command interp1 if my hours repeats in my column because I have multiple days. So say:
new_timeinhr = 0:0.25:max(A(:,3);
day_hour = rem(new_timeinhour, 24);
new_timeinhr( day_hour <= 9.2 | day_hour >= 16.1 ) = [];
days=unique(A(:,1));
for j=1:length(days);
if A(:,1)==days(j);
int_prices(j) = interp1(A(:,2), A(:,3), new_timeinhr);
end;
end;
of course the error is now: In an assignment A(I) = B, the number of elements in B and I must be the same.
How can I write the int_prices(j) to stack?