www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/DisplayMarkersAtMaximumAndMinimumDataPointsExample.m
%% Display Markers at Maximum and Minimum Data Points % Create a vector of random data and find the index of the minimum and % maximum values. Then, create a line plot of the data. Display red % markers at the minumum and maximum data values by setting the % |MarkerIndices| property to a vector of the index values. x = 1:100; y = rand(100,1); idxmin = find(y == max(y)); idxmax = find(y == min(y)); plot(x,y,'-p','MarkerIndices',[idxmin idxmax],... 'MarkerFaceColor','red',... 'MarkerSize',15)