필터 지우기
필터 지우기

Replace values in a matrix below 1% and above 99%

조회 수: 1 (최근 30일)
FC93
FC93 2017년 2월 8일
댓글: FC93 2017년 2월 8일
I have a big Matrix. In the Matrix I have a lot of values but also some NaN. Now £I want to replace all values that are below 1% percentil with the corresponding value of the 1% percentil. In a next step I want to replace all values above the 99% percentil with the value at the 99% percentil.
An example: If we take all numbers in the Matrix and the 1% percentil is 2, then I want to replace all values below 2 with 2.
Thank you for your help.

채택된 답변

Adam
Adam 2017년 2월 8일
편집: Adam 2017년 2월 8일
lowPercentileVal = prctile( myMatrix(:), 1 );
myMatrix( myMatrix < lowPercentileVal ) = lowPercentileVal;
highPercentileVal = prctile( myMatrix(:), 99 );
myMatrix( myMatrix > highPercentileVal ) = highPercentileVal;
  댓글 수: 1
FC93
FC93 2017년 2월 8일
Thank you for your help. This is what I was looking for.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by