What if we need the indices of the original matrix, where the sequential values โโare located? Further, what if we want to get a matrix of the same size as the original matrix, where the number of consecutive values โโis stored in the consecutive value indices? For instance:
original_matrix = [1 1 1;2 2 3; 1 2 3]; output_matrix = [3 3 3;2 2 0;0 0 0];
This issue is related to the quality control of meteorological data. For example, if I have a temperature data matrix from several sensors, and I want to know which days had constant consecutive values โโand how many days were constant, so I can then mark the data as possible malfunctions.
matrix temperature is the number of days x the number of stations, and I want the output matrix to also be the number of days x the number of stations where consecutive values โโare marked as described above.
source share