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

조회 수: 3 (최근 30일)
swathi
swathi 2020년 8월 17일
댓글: swathi 2020년 8월 17일
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