sir i have 95 year daily model output rainfall data form 2006-1-1 to 2100-1-1.i want to take out nov to feb from every year lear all;close all;clear global;
load prec_GFDL_CM3_rcp26.mat X1 Y1 prec_all_years;
%load prec_GFDL_CM3_rcp85.mat X1 Y1 prec_all_years;
% the data is for 95 years;
% here i am selecting the data from may to oct only i.e. 184 data points every year;
xx = [];
for i = 1:95;
if i==1
xx = [xx (i-1)*[1:59]];
elseif i == 95;
xx = [xx (i-1)*[11339:11400]];
else
xx = [xx (i-1)*365+[305:424]];
end
end
prec_all_years1 = 86400*prec_all_years; % the rainfall is converted to mm/day
prec_nov_feb = prec_all_years1(:,:,xx);
% daily maximum rainfall over India
[mm nn tt]=size( prec_all_years1);
for jj = 1:tt;
yy = prec_all_years1(:,:,jj);
max_rainfall(jj) = max(yy(:));
end
this is not work properly
please help me .Thank you!

댓글 수: 1

Original question in case vanuesh deletes it:
sir i have 95 year daily model output rainfall data form 2006-1-1 to 2100-1-1.i want to take out nov to feb from every year lear all;close all;clear global;
load prec_GFDL_CM3_rcp26.mat X1 Y1 prec_all_years;
%load prec_GFDL_CM3_rcp85.mat X1 Y1 prec_all_years;
% the data is for 95 years;
% here i am selecting the data from may to oct only i.e. 184 data points every year;
xx = []; for i = 1:95; if i==1
xx = [xx (i-1)*[1:59]];
elseif i == 95;
xx = [xx (i-1)*[11339:11400]];
else xx = [xx (i-1)*365+[305:424]];
end
end prec_all_years1 = 86400*prec_all_years; % the rainfall is converted to mm/day
prec_nov_feb = prec_all_years1(:,:,xx);
% daily maximum rainfall over India
[mm nn tt]=size( prec_all_years1);
for jj = 1:tt;
yy = prec_all_years1(:,:,jj); max_rainfall(jj) = max(yy(:)); end
this is not work properly please help me .Thank you!

댓글을 달려면 로그인하십시오.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2014년 4월 4일
편집: Andrei Bobrov 2014년 4월 21일

0 개 추천

Let the 'a' is date for first frame of your 3D matrix (eg 'prec_all_years')
a = [2006,1,1];
[m,n,k] = size(prec_all_years1);
dten = datenum([2006 1 1 ;2100 1 1])
[~,M] = datevec(datenum(a) + (0:k-1)');
xx = ismember(M,[11 12 1 2]);
p = prec_all_years1(:,:,xx);
max_rainfall = max(reshape(p,m*n,[]));
add
[m,n,k] = size(prec_all_years1);
ii = cumsum(eomday(2014,1:12));
x0 = rem(0:k-1,365)+1;
xx_logic = x0 <= ii(2) | x0 > ii(10);
p = prec_all_years1(:,:,xx_logic);
max_rainfall = max(reshape(p,m*n,[]));

댓글 수: 10

Andrei Bobrov
Andrei Bobrov 2014년 4월 4일
편집: Andrei Bobrov 2014년 4월 4일
comment by Varunesh
sir Andrei Bobrov this is daily data not monthy.sir my precipitaion data size is 12x16x34675 (lat,lon.time) for india region.sir please help me. this is not include leap years. thank you.
Andrei Bobrov
Andrei Bobrov 2014년 4월 4일
please see code after add in this answer
varunesh
varunesh 2014년 4월 4일
Andrei Bobrov Sir this code is not running properly and giving this error (Error using size Too many output arguments.)
Andrei Bobrov
Andrei Bobrov 2014년 4월 4일
corrected
varunesh
varunesh 2014년 4월 4일
Andrei Bobrov sir this is also giving same error (Error using size Too many output arguments.)
Andrei Bobrov
Andrei Bobrov 2014년 4월 4일
corrected
varunesh
varunesh 2014년 4월 4일
Andrei Bobrov sir this code is running properly.thank you so much sir.
varunesh
varunesh 2014년 4월 5일
Andrei Bobrov sir if this will be include leap years then what will be change or add in this code ? thank you.
varunesh
varunesh 2014년 4월 5일
Andrei Bobrov sir if this will be include leap years then what will be change or add in this code ? thank you.
Andrei Bobrov
Andrei Bobrov 2014년 4월 21일
Please see my code befor word 'add'

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Calendar에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

질문:

2014년 4월 4일

편집:

2015년 8월 28일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by