How to extract certain rows from an excel file?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all,
I have quite a large excel file wherein the first coloum is a 'timestamp' that goes on for several days. I only want to extract certain days data for example I would like to extract data from 2018-11-09 00:00:05.000 to 2018-11-10 00:00.05.000 or alternatively other dates too.
I basically want to extract all the other data next to it for those date ranges- any idea how to do that with xlsread?
Many thanks! (Image attached)
댓글 수: 0
답변 (2개)
madhan ravi
2019년 1월 14일
Use readtable() to read the file and then extract only the required datas.
댓글 수: 0
Walter Roberson
2019년 1월 14일
MATLAB cannot know which rows satisfy your time bounds until it has read the data.
If you can count on the times being 10 seconds apart, then read A1:A1 to get the base time, and then calculate from it how many rows further on you need to go in order to reach the start of where you want to read, and also the end of where you want to read, and then ask to read those rows (either xlsread or readtable.)
If you cannot count on the times being 10 seconds apart, but you can count on the times being in increasing order, then since you seem to be using MS Windows (Excel for Mac has different colors than what you show), you could create an activeX control to talk to Excel, and have it read individual times, and do a binary search to find the rows for the start and end times.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!