Having difficulty filtering data and extracting some information from data.

조회 수: 2 (최근 30일)
Mate 2u
Mate 2u 2013년 4월 15일
Dear all, I have a 1x3 Cell. In these 3 cells I have:
Column 1 (cell 600000 x 1), with dates in the form of mm/dd/yyyy
Column 2 (Single 600000 x 1), with prices.
Column 3 (uint16 600000 x 1) with trades.
I want to do the following:
1) Delete all entries which are not in 2008 (Delete the rest due to memory restrictions of making more matrixes/arrays)
2) Once I have all the data for 2008, I would like to store in a separate array the Last price for each day within 2008.
3) For 2008, I would like to store in a separate array the number of prices for everyday (there are uneven intervals).
4) Lastly for 2008, I would like to store in a seperate array the sum of trades everyday.
Therefore (2) and (3) will all be the same size.
  댓글 수: 3
Mate 2u
Mate 2u 2013년 4월 15일
Column 1: '09/10/2007' '09/10/2007' '09/10/2007'
Column 2: 12541 12541 12545
Column 3: 1 1 1
Mate 2u
Mate 2u 2013년 4월 15일
segarray is our 1x3 cell with all the data
DateVector=datevec(segarray{1,1});
for i = 1:length(DateVector)
if DateVector(i,1) ~= 2008
segarray{1,1}(i,1)=[];
segarray{1,2}(i,1)=[];
segarray{1,3}(i,1)=[];
end
end
I thought this will solve 1) but no it doesn't.

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

답변 (1개)

Sean de Wolski
Sean de Wolski 2013년 4월 15일
편집: Sean de Wolski 2013년 4월 15일
Use datevec on your date string to idenitfy the year. Then use logical indexing to discard everything that is not in 2008.
doc datevec

카테고리

Help CenterFile Exchange에서 Time Series Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by