You can do it in one line of code. You just first need to decide if you want to locate occurrences of the global min, or if you want to find local mins (using imregionalmin), AND if you want a vector of logical indexes or a vector of actual indexes. Since you didn't say, I'm giving all 4 possibilities:
vec = [1,1,2,2,1,2,1,3,0,-1,4,0,3,-1,5];
localMinIndexes = imregionalmin(vec)
globalMin = min(vec);
globaMinIndexes = vec == globalMin
localMinIndexes = find(imregionalmin(vec))
globaMinIndexes = find(vec == min(vec))
Best Answer