# How to find a pattern in an array?

22 ビュー (過去 30 日間)
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
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?
##### 51 件のコメント49 件の古いコメントを表示49 件の古いコメントを非表示
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 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?

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeLogical についてさらに検索

### Community Treasure Hunt

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

Start Hunting!

Translated by