File Exchange

image thumbnail

Integer to Integer map using logical indexing

version 1.0.0.0 (920 Bytes) by Sathyanarayan Rao
Logical indexing is used to map integer from one set to another

0 Downloads

Updated 30 Aug 2017

View License

Given two sets of integer, integer is mapped from one set to another. The author acknowledges Stephen Cobeldick
for his suggestion on using ismember to perform same task
[~,idx] = ismember(A,map2);
B = map1(idx);

Comments and Ratings (1)

Jan

Jan (view profile)

For tiny problems with max(map2) < 1000 a look up table is efficient also:

LUT = nan(1, max(map2));
LUT(map2) = map1;
mapped = LUT(original)

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor