, . , y-.
RBBOX .
:
% sample data
data = rand(1,100);
datax = 1:numel(data);
% draw simple plot
plot(data,'.')
% select the points with mouse and get coordinates
k = waitforbuttonpress;
point1 = get(gca,'CurrentPoint'); % button down detected
finalRect = rbbox; % return figure units
point2 = get(gca,'CurrentPoint'); % button up detected
point1 = point1(1,1:2); % extract x and y
point2 = point2(1,1:2);
pmin = min(point1,point2);
pmax = max(point1,point2);
% find the data selected and get average of y values
idx = data >= pmin(2) & data <= pmax(2) & datax >=pmin(1) & datax <= pmax(1);
dataAverage = mean(data(idx));
rbbox.