필터 지우기
필터 지우기

Extract Data between two time points

조회 수: 20 (최근 30일)
Austin Bollinger
Austin Bollinger 2021년 12월 17일
댓글: Star Strider 2021년 12월 18일
Is there a way to extract data between two time points that have an event marker on a graph? I am trying to extract some data between time 42 seconds and 90 seconds and from 128 seconds to 191 seconds. I do not need the data before or after those points. Does the inbetween function work for this?
  댓글 수: 2
Sargondjani
Sargondjani 2021년 12월 18일
If I understand correctly you have datapoints, and you want to interpolate between them?
You can use griddedInterpolant for this.
Austin Bollinger
Austin Bollinger 2021년 12월 18일
Yes datapoints in between the time points that I am looking at. Thank you!

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

채택된 답변

Star Strider
Star Strider 2021년 12월 18일
Much depends on what the times are.
Example —
tv = linspace(0, 200, 500); % Time Vector ('double' Array)
data = sin(2*pi*tv*0.25); % Signal Vector
Lvx1 = ((tv >= 42) & (tv <=90)); % Logical Vector
Lvx2 = ((tv >= 128) & (tv <= 191)); % Logical Vector
figure
subplot(3,1,1)
plot(tv, data)
grid
xlim([min(tv) max(tv)])
title('Original')
subplot(3,1,2)
plot(tv(Lvx1), data(Lvx1))
grid
xlim([min(tv) max(tv)])
title('42 -> 90')
subplot(3,1,3)
plot(tv(Lvx2), data(Lvx2))
grid
xlim([min(tv) max(tv)])
title('128 -> 191')
If the times are datetime or duration arrays, the concept is essentially the same, although different code is required.
.
  댓글 수: 2
Austin Bollinger
Austin Bollinger 2021년 12월 18일
It is just based on time in seconds. Your example helped trigger what I should do. Thank you!
Star Strider
Star Strider 2021년 12월 18일
As always, my pleasure!
.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by