From: Andrius Gaigalas on
I make a scatter plot and then use the tool impoly to define a ROI on the scatter plot. Is there a way to get the mean and stdev of the data in the ROI?
From: Walter Roberson on
Andrius Gaigalas wrote:
> I make a scatter plot and then use the tool impoly to define a ROI on
> the scatter plot. Is there a way to get the mean and stdev of the data
> in the ROI?

get() the Position of the returned polygon, and split it into X and Y coordinates.

get() the positions from the scatter plot, and pass those positions along with
the ROI vertices to inpolygon() in order to create a binary mask of which
points are inside the roi or not. logical() that binary mask and use that for
logical indexing of the information you want to create the mean and standard
deviation of, and go ahead and call mean() and whatever on the selected
information.