Applying monthly coefficients to daily data
Show older comments
Sorry if the question is elementary but I am trying to do a daily soil moisture balance for a long dataset but am using monthly crop coefficients. I have a column in my main array where I have used the "month(A)" function and I have made a month column in the array storing my coefficient.
I want to apply the corresponding co-efficient to the correct month for each day of the ~100 years. The following code does the job but am new to MATLAB and hoping to find something neater.
Where Data(:,n) are the appropriate columns of the main dataset and kcT(:,n) are columns in the array containing co-efficients with the corresponding month.
for i=1:12
for j = 1 : length(Data(:,1))
if Data(j,4)==kcT(i,2)
DID(j,1)=Data(j,2)*kcT(i,1);
end
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!