How to ignore value that is in vector when the box plot is used

1 次查看(过去 30 天)
I calculated the median by box plot.
But I want to ignore some data that is in vector array to calculate that.
I have a 1x9 vector and reshape to 3x3 vector.
And getting median value by each colums.
But I want to ignore by position like [1x1],[2x3] these two positions.
So then the value of first column is considered only [5, 1] except [1x1]
and third column is considered only [ 3,6] exacept [2x3].
I can remove that position before reshape.
But if i do that, I can't get [3x3] vector. The value might be positioned wrong.
How to solve this?
A = ([1, 2, 3, 5, 3, 4, 1, 3, 6]);
A = reshape(A,[3,3]);
A = ([1, 2, 3],
[5, 3, 4],
[1, 3, 6]);
^ ^ ^
%I have to get the median value from each column after doing reshape.
for
A_ = median([ ]);
end
  2 个评论
Walter Roberson
Walter Roberson 2018-12-29
The result of the call to median is a scalar . It does not make sense to ignore things indexed into a scalar .
Are you wanting to ignore input values?If so then ignore by position or ignore by value?

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2018-12-29
let the numeric values be in VV
A = median( V(~ismember(V, [0,20])) )
  2 个评论
CHOI HYUNDUK
CHOI HYUNDUK 2018-12-29
I edited my question a little bit. Coudl you give me that more detail?
Walter Roberson
Walter Roberson 2018-12-30
With newer releases,
T = reshame(A, 3, 3);
T(1,1) = nan; T(2,3) = nan; %set those positions to nan
A_ = median(T, 1, 'omitnan')

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by