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

3 views (last 30 days)
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)

Accepted Answer

Cris LaPierre
Cris LaPierre on 17 Aug 2020
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),:)

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!