I need to find a pattern in a column
4 ビュー (過去 30 日間)
I need to count the number of repetition of a pattern in my data. The pattern is a serie of 35 zeros. The problem is that I didn`t find how to do it in column cause my data are un one column.
Thank you for your help
Chris 2021 年 11 月 8 日
A = readmatrix('test.xlsx');
count = 0;
for idx = 1:numel(A)-34
if sum(A(idx:idx+34)) == 0
count = count+1;
If there is a series of N>35 zeros, this wll count the pattern multiple times (for example, if there are 36 zeros in a row, that's two patterns of 35).
Also, there are probably more efficient ways to do this.