简体   繁体   中英

Extract data from plot using “Brush/Select Data” in Matlab

In my plot I have x-axis in datetime format and y is corresponding observations. There are a few clusters of anomalies which I can visually recognise. I tried to select the anomalies using `Brush/Select data' tool in the figure, but when I tried to copy data on the clipboard and pasted in notepad, the data is not in datetime format and I can not interpret it.

I would like to select the data from plot and remove the indices from the dataset. I am providing a sample of data I copied from brush tool.

56.5868518518519    463.32834344035
56.6596759259259    463.337
56.6603240740741    463.335
56.6608217592593    463.326 

Thanks在此处输入图像描述

Have you looked at rmoutliers(A ) ? If all you need is to remove the outliers this function will do exactly that.

If you for whatever reason cannot use the function, you can use this:

% Compute the median absolute difference
meanValue = mean(vector)
% Compute the absolute differences.  It will be a vector.
absoluteDeviation = abs(vector - meanValue)
% Compute the median of the absolute differences
mad = median(absoluteDeviation)
% Find outliers.  They're outliers if the absolute difference
% is more than some factor times the mad value.
sensitivityFactor = 6 % Whatever you want.
thresholdValue = sensitivityFactor * mad;
outlierIndexes = abs(absoluteDeviation) > thresholdValue
% Extract outlier values:
outliers = vector(outlierIndexes)
% Extract non-outlier values:
nonOutliers = vector(~outlierIndexes)%Compute the median absolute difference

Credit goes to this guy but its a very simple approach and should do exactly what you need

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM