Organize Data Using Cell Array of Time stamps?

Hi, I am trying to write a program that finds a major change to a known temperature. The data provided to me is in the form of an excel spreadsheet that contains a month's worth of data. The spreadsheet has a column headings of TAG DATE T1. I need to separate this column of timestaps by day so that I can use the index to find organize the temeperatures by day.
The beginning starts like this
raw_data=importdata('filename');
time_stamps=(raw_data.textdata(2:end,10));
new_time=datestr(time_stamps)
I want to use some variety of the find function to look for specific phrases in each timestamp eg. (1/20/2009)
time_stamps is a 43885x1 cell with terms that look like this '1/20/2009 7:00'
new_time is a string that I thought would help but actually seems less helpful.
Any ideas? Thanks

답변 (1개)

Iain
Iain 2013년 5월 21일

0 개 추천

index = find(strcmpi(desired_date,time_stamps));

댓글 수: 2

The asnwer using that is
index =
Empty matrix: 0-by-1
I can use
strmatch({'1/20/2009'},time_stamps)
I think. But I would have to run each date through this. I could use a date matrix and a loop but the matrix doesn't come out right if I use a format like
[1/20/2009 1/21/2009....] or ['1/20/2009' '1/21/2009' ..... ]
Iain
Iain 2013년 5월 21일
For strcmpi to work, you need to ensure that the date you search for is an EXACT match to an entire string - this would, by necessity, include the time.
I would suggest that you consider changing the dates to serial date numbers via "datenum", you can then use
serials = datenum(time_stamps);
index = find(serials > datenum(desired_date),1)

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

카테고리

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

제품

질문:

2013년 5월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by