Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

how map range of values ?

Asked by huda nawaf

huda nawaf

on 10 May 2012
Accepted Answer by Walter Roberson

Walter Roberson

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

0 Comments

huda nawaf

huda nawaf

Tags

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson

Walter Roberson

on 10 May 2012
Accepted answer

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 Comment

huda nawaf

huda nawaf

on 11 May 2012

thanks walter

Walter Roberson

Walter Roberson

Contact us