How to replace arrays containing consecutive repeated numbers by zero?
Show older comments
I have a nested cell array that consists of vectors as shown in Fig. below:

I want to go through each cell array and check it if contains atleast 50% of consecutive repetated numbers. If the cell array contains such numbers, then I want to fill the entire cell array with zeros.
See example below. In this case all the elements of cell array contains consecutive repeated numbers. I want to replace the entire cell array with zeros.

Note: The reason why I mentioned 50% is that, there were many cell arrays where the first 36,000 or so elements were normal but the other half (36,000) contained consecutive repeated numbers.
Accepted Answer
More Answers (1)
Image Analyst
on 24 Aug 2020
0 votes
Use a for loop and diff(). If you can't figure it out, attach a small chunk of your cell array in a .mat file.
Categories
Find more on Data Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!