RankData

버전 1.0.1 (2.67 KB) 작성자: thosman
Matlab function to rank each element of data.
다운로드 수: 39
업데이트 날짜: 2022/3/13

RankData

rank = RankData(data, alongDim, invalidRank)

Matlab function to rank each element of data.

Handles all data types accepted by matlab function unique.

Inspiration

Inspired by procrastination and this pick-of-the-week blog post to create a simple function that ranks data but simpler, much faster, and without the limitations from the previous submission.

Params

  • alongDim [default []] - If empty, rank across all entries. If not empty, rank along entries for the specified dim
  • invalidRank [default NaN] - Value invalid entries are set to.

Examples

Example 1

data = randn(2,3,4);
rank = RankData( data )

Example 2

Shows how repeated and invalid entries are handled.

data = [10 nan 11 nan nan 1 2 5 1 7];
rank = RankData(data)

Example 3

Shows how data types like categorical and its invalid data can be naturally handled.

data = randn(5);
data = discretize(data,linspace(0,1,10),'categorical');
rank = RankData(data)

Example 4

Output similar to tiedrank. While we demonstrate matched results, RankData can handle non numeric entries.

data = rand(3,4,2);
data(3,:,:) = data(2,:,:); % Match entries to force ties
alongDim = 1;
rank = tiedrank(RankData(data,alongDim));
isequal(rank,tiedrank(data))

인용 양식

thosman (2024). RankData (https://github.com/tommyhosman/RankData), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2019b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가

Community Treasure Hunt

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

Start Hunting!

GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보
1.0.1

Added alongDim

1.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.