How to find a pattern in an array?

조회 수: 16 (최근 30일)
Susan
Susan 2022년 8월 12일
댓글: Susan 2022년 8월 27일
Hi All,
I have an array (attached) and I'd like to find where a specific pattern happens in the array.
I know that by knowing the pattern we can find how many times and where in the array this pattern happens using the following code (How to find pattern in an array? - (mathworks.com))
clear all
clc
data = importdata('C:\User\Downloads\test\TEST.txt');
A = '118'; % Pattern
B = convertStringsToChars(data{1,1});
SIZE = length(B) - length(A);
match = zeros(1, SIZE);
for i=1:SIZE
match(i) = all(B(i:i-1+length(A)) == A);
end
output = find(match == 1);
size(output)
However, my question is if I know a pattern happens X times, say 100 times, in the array while I don't know what the pattern is, Is it possible to find the pattern?
Many thanks in advance!
  댓글 수: 51
dpb
dpb 2022년 8월 26일
If our presumptions were correct, the orientation in the file should be sequentially in time for each channel -- so if you have a channel disconnected, its constant signal should show up as every 1:8:N values if our assumption that the channels are multiplexed is correct. This appears must be so given the flat line in your plot, but would be good to visually inspect the layout directly to be sure.
A 300 mV DC signal at G=10 counts/mV would output 3000 counts.
That then I presume is with an open input channel? What if you ground the unconnected channel(s)?
Susan
Susan 2022년 8월 27일
@dpb Thanks for your quick response. Appreciate it. When I knew that only one channel was recorded and the rest were open input channels, I got a t*8 matrix that only one channel had data, and all the rest values/matrix entries were fixed to 3000.
You're right; it is with an open input channel. I haven't grounded the unconnected channels yet, but I will.
Then, if I assume every ten units (or whatever) equals 1mV, then how to interpret the 2*10^3mV of ECG's amplitude?

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by