Importing data from specific columns of a data structure

조회 수: 1 (최근 30일)
Shirin
Shirin 2022년 6월 25일
편집: Voss 2022년 6월 26일
Hello all,
I am working on a large data file and want to extract the data for specific dates. The format of the file resembles the following:
Date Location Degree1 Degree2
20200101 NY 0 1
20200102 NY 0 0
20200103 NY 1 3
Now what if I want to extract all the data from 20200101 to 20200103?

채택된 답변

Voss
Voss 2022년 6월 25일
T = readtable('data.txt')
T = 6×4 table
Date Location Degree1 Degree2 ________ ________ _______ _______ 2.02e+07 {'NY'} 0 1 2.02e+07 {'NY'} 0 0 2.02e+07 {'NY'} 1 3 2.02e+07 {'NY'} 1 9 2.02e+07 {'NY'} 2 7 2.02e+07 {'NY'} 2 6
T(T.Date >= 20200101 & T.Date <= 20200103,:)
ans = 3×4 table
Date Location Degree1 Degree2 ________ ________ _______ _______ 2.02e+07 {'NY'} 0 1 2.02e+07 {'NY'} 0 0 2.02e+07 {'NY'} 1 3
  댓글 수: 3
Shirin
Shirin 2022년 6월 26일
This helps a lot; thank you so much.
Voss
Voss 2022년 6월 26일
편집: Voss 2022년 6월 26일
You're welcome!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Standard File Formats에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by