I know this is a common question, so sorry in advance, but the other responses have not been working with mine, probably because I haven't been Implementing them correctly, which is why I'm here. In the code below, i have a file that contains a variabe LAnkle, which is 205x4. I am only concerend with the first and fourth columns however. The goal is to find the trough points, where the previous and following values are greater, and put them in the array y. However, when I do this y only equates to one value, it seems to be overwritten everytime. When I use disp(x) in the script, it displays all values in the fourth column as well, not just the trough points. Any help is appreciated.