unable to select data-points in a plot

12 次查看(过去 30 天)
I need to programmatically generate a plot in which I need to dynamically select and deselect data points. which I am not able to do using the following code:
y = [2.091666958,1.929444472,1.954580163,1.903415586,1.875379629,1.875379629,1.903415586,1.875379629,1.942330552,1.903415586,1.903415586,1.929750906,1.942330552]'
x = [7.163732175,7.009281649,5.203296758,7.0004477,7.087439702,7,7.012988611,7.002354474,5.274252552,5.38274806,7.000976802,7,5.321121833]'
UIAxes = uiaxes
UIAxes.XGrid = 'on';
UIAxes.YGrid = 'on';
UIAxes.XMinorGrid = 'on';
UIAxes.YMinorGrid = 'on';
UIAxes.YScale='log';
UIAxes.XScale='log';
starting_x = [1 1];
fitfun = fittype(@(a0,a1,x) a0+(a1.*x));
[fitobject,gof,output] = fit(x,y,fitfun,'StartPoint',starting_x);
fig = figure('Visible','off');
ax = axes(fig);
FigHandle = plot(fitobject,x,y,'or');
hApp = copyobj(FigHandle, UIAxes);

回答(1 个)

Sambit Supriya Dash
[FDT,ROL] = rmoutliers(y);
OL = y(ROL) % this would be your detected outliers in your dataset (dependent variable)
  1 个评论
M K P Dev
M K P Dev 2021-7-17
Thank you sambit for the repy.
It was my mistake that I used the words outliers instead of data points.
The problem is that I need to select datapoints graphically from the generated plot. remove them and replot it.
the removed data points should also be shown but with a cross mark, so that I can once again select them and replot the graph.

请先登录,再进行评论。

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by