Find duration of signal

조회 수: 3 (최근 30일)
Marc Elmeua
Marc Elmeua 2020년 9월 9일
댓글: Xavier 2020년 9월 10일
I have a set of signals that due to some unknown error have been acquired with millions of empty datapoints. Is there a way I can automatically detect the moment the signal ends so I can delete everything from that point onwards?
Thanks everyone.
  댓글 수: 4
Star Strider
Star Strider 2020년 9월 9일
There are no actual ‘missing’ values, just a very low amplitude signal after about element 40:
T1 = readtable('sampledata.csv');
figure
semilogy(abs(T1{:,1}))
grid
producing:
That would appear to be legitimate data.
.
Xavier
Xavier 2020년 9월 10일
This depends on how you define legitimate data, if you unplug a probe/sensor from an oscilloscope it will continue to display numbers and a waveform. If you're trying to measure a signal then it is fair to call recorded noise invalid data

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

채택된 답변

Xavier
Xavier 2020년 9월 10일
Something like this may work for you
Raw data:
data = readmatrix('sampledata.csv');
avgdat = movmean(abs(data), 5);
threshold = 0.01;
data(avgdat < threshold) = [];
plot(data)
  댓글 수: 2
Marc Elmeua
Marc Elmeua 2020년 9월 10일
This worked perfectly!! thanks a lot.
Xavier
Xavier 2020년 9월 10일
No problem!

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

추가 답변 (1개)

Steven Lord
Steven Lord 2020년 9월 9일
If the empty data points are represented by NaN then find the 'last' 1 element of the vector that isfinite.
x = [1:10 NaN(1, 5)]
find(isfinite(x), 1, 'last')
If the vector has no missing data inside it, you could instead just rmmissing.
rmmissing(x)
  댓글 수: 1
Marc Elmeua
Marc Elmeua 2020년 9월 9일
Thanks for the reply! The missing values aren't really missing in the matlab file. They are missing in the original data collection software but as soon as you retrieve them, they turn into zeros so this code will not work :(
I'm in touch with the developers of the software but they still haven't been able to solve this.

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

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by