[B,TF] = rmoutliers(A,method) on older MATLAB version (2016) ?

3 次查看(过去 30 天)
my file size is [12*3]; i am writing without inbuilt function code and i am struct at nonoutlier
in this figure shows my isoutlier ''B'' output ;in that if 1 is present in any one [X,or Y, or Z] of the column remove entire row of [X,Y,Z]
and i was struct at my nonoutliers output matrix is [32*1]
can you help me to get nonoutlier matrix size [8*3]
i need your help,thank you
S = readtable('object.xlsx');
X = S.X;
Y = S.Y;
Z = S.Z;
position = [X Y Z];
TF=median(position);
M_d=mad(position,1);
c=-1/(sqrt(2)*erfcinv(3/2));
smad=c*M_d;
tsmad=3*smad
B=(abs(position-TF)>=tsmad);
outlier = position(B);
nonoutliers = position(~B)

采纳的回答

Cris LaPierre
Cris LaPierre 2020-8-17
It is 32x1 because you are using linear indexing. This happens when you index an array with a single index (even though that index may be an array).
3 columns x 12 rows = 36 elements
36 - 4 outliers = 32
If you want an array back, you must supply row and column indeces. Try something like this for the final line of code:
nonoutliers = position(all(~B,2),:)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Array Geometries and Analysis 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by