Difficulty to get the results by using repmat function
Show older comments
Hello everyone, I am working on climate data and I have a matrix size of 12x361, (where the 12 represents the months and 361 represents the columns).
Now i want to repeat the factor values of each corresponding months (Jan-Dec) of the 361 stations into 30years (say 1931 to 1961) on the daily wise.
For example i have "Jan" month factor value of 0.778, "Feb" month is 0.65, "Mar" is 0.56 ....and Dec is 0.69, Now i want to repeat the each factor value
of the particular months into days and into 30years for all the 361 stations and the data should be arranged serially (say Jan-1931, Feb-1931... Dec-1960)
I have tried the code below shown for your reference and required your valuable suggestions to proceed further.
load BCC_CF_Mul_pr_1961.mat
b=BCC_CF_Mul_pr_1961(:,1:361); %12rows of factor values for all the 361 stations
% Inserts Year and Months
x=bsxfun(@(Month,Year) datenum(Year,Month,1),(1:12).',1931:1960);
x=x(:);
d=datevec(x);
d=d(:,1:2);
%inserting number of days in a month of the year
a1=eomday(d(:,1),d(:,2));
%Repeat the evry month of the factor values to the days caculated from the previous step
a2=repmat(b(1),a1(1),1); %this line repeats the values only for that month
Kindly help me to proceed further
Thank you
Accepted Answer
More Answers (0)
Categories
Find more on Climate Science and Analysis 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!