I am trying to categorise the years based on some conditions. If any year has rainfall less than a specific number it will indicate as a dry year. I have tried the following, but it gives me error "In an assignment A(I) = B, the number of elements in B and I must be the same."
The code is
Year_Category = zeros(ny,1);
for i = 1:ny;
if (xy(i)< Lower_Limit)
Year_Category(i) = 'Dry';
elseif (xy(i)> Upper_Limit)
Year_Category(i) = 'Wet';
else
Year_Category(i) = 'Average';
end
end
Any help would be appreciated.
Best regards