필터 지우기
필터 지우기

Scanning signal/Storing anything other then zeros

조회 수: 1 (최근 30일)
Sebastian Daneli
Sebastian Daneli 2021년 6월 14일
댓글: Rik 2021년 6월 15일
Hi
I have a filtered signal where the base line is zero that looks in principle like this:
[0 0 0 -1 2 -2 0 0 0 2 1 -1 0 0 0 2 3 1 0 0 0...]
I wish to scan the signal and store the structures within it in a matrix such as this one:
[-1 2 -2; 2 1 -1; 2 3 1;...]
Which is the most efficient way to do this? Can I use the find function efficiently for this?
  댓글 수: 1
Rik
Rik 2021년 6월 15일
Regarding your flag ("I asked this question, but realized I didn't ask the correct question that I need answered."): what do you want to happen? Should this thread be deleted just because you asked a different question from what you wanted?
If the answer didn't solve your actual problem, why did you mark it as accepted answer? You can post comments with clarifications to make sure you are making clear what you want to know.

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

채택된 답변

Mathieu NOE
Mathieu NOE 2021년 6월 14일
hello
my suggestion / demo code :
I understand the output must be a matrix of 3 columns;
tol = eps; % set a tolerance value (very low but not zero)
a = [0 0 0 -1 2 -2 0 0 0 2 1 -1 0 0 0 2 3 1 0 0 0]; % input data
b = a(abs(a)>tol); % remove zero (below tol) data
c = (reshape(b,[],3))'; % reshape in 3 columns matrix and transpose
c =
-1 2 -2
2 1 -1
2 3 1

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by