T = readtable('matlab_question2.csv');
idx = find(diff(T.x))
The first line reads your CSV file into a table that contains the variable x.
The function diff computes the differences between adjacent elements of its input.
The function find then returns the indices where the adjacent element differences are nonzero. These are the locations where the values change. For example: