필터 지우기
필터 지우기

replace p percent of largest values in matrix columns

조회 수: 1 (최근 30일)
Razieh
Razieh 2015년 4월 16일
편집: Guillaume 2015년 4월 16일
Hi friends, I want to replace p percent of largest values of each individual column in A matrix (size m by n) with NaN. would you plz help me ,

채택된 답변

Guillaume
Guillaume 2015년 4월 16일
편집: Guillaume 2015년 4월 16일
By "I want to replace p percent of largest values", I assume you mean replace the value of A that are greater than (1-p) * max_value_of_A. If not, you'll have to clarify what you mean.
A = rand(8, 10) %for example
p = 0.1; %for example
maxvalue = max(A(:));
threshold = (1-p) * maxvalue;
A(A >= threshold) = NaN

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by