skipping lines in double array

조회 수: 2 (최근 30일)
Lilya
Lilya 2015년 11월 16일
댓글: dpb 2015년 11월 16일
Hello all, I have a double array which contains data for date time and related parameters of it. The question is how to skip lines in it? I want to select the data (according to months) not sequentially for 3 sets:
1- for months 1,2,3,4,5,8,10
2- 6,7,9
3- 11,12
the dimensions are:
744 for 1,3,5,7,8,10,12
672 for 2
720 for 4,6,9,11
thank you for your help in advance.
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 11월 16일
double arrays cannot contain strings.

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

채택된 답변

dpb
dpb 2015년 11월 16일
How's the date stored? If you have month,day,year and want rows of a given set of months, then select the ones desired by ismember or any other equivalent operation...trivial example assuming an array 'x' with yr,mo,da,data... as the columns in order
sel={[1:5,8,10];[6 7 9];[11 12]}; % define the grouping month values
for i=1:length(sel) % for each group
z=x(ismember(x(:,2),sel{i}),:); % select rows according to the group
% do whatever is wanted here with the selection...
...
end
  댓글 수: 2
Lilya
Lilya 2015년 11월 16일
dpd, It's a serial date number (duodenum). thus, it is not including no. Of months individually (day month year)
dpb
dpb 2015년 11월 16일
Well then first use datevec on it to get the [y,m,d] vectors.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by