how map range of values ?

조회 수: 3 (최근 30일)
huda nawaf
huda nawaf 2012년 5월 10일
I have 48794 unique values, i need 16 bit to represent it as binary code. where 2^16=65536.
but the problem that these 48794 valuse are not numbered from 1 to 48794.
my values are given id's between 1 and 66726. i.e max value be 66726 , in this case I have to use 17 bit to represent them uniquely.
how i can map my values to be from 1 to 48794?
thanks in advance

채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 10일
unique() the list of IDs. The mapped ID is then the index of the ID in the unique array. There are performance optimizations that can be made if the lookups happen frequently enough to justify the memory.
  댓글 수: 1
huda nawaf
huda nawaf 2012년 5월 11일
thanks walter

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by