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!