|
From: Bruno Luong on 16 Jul 2010 02:48 "Namo Namo" <wynamo(a)yahoo.com> wrote in message <i1ooqv$31l$1(a)fred.mathworks.com>... > I need to re-assign the elements in a matrix to another set of values. The simplest, say, is > to assign by order stats. For example, if I have > > a = [ 1 3 4 6 3 1 4 ]; > > By order stats, I only have 4 unique elements 1 3 4 6. I would like to re-number the elements to 1 2 3 4. Currently I am using unique: > > [d, I, J] = unique( a(:) ); > new = 1:length(d); > a2 = new(J); > [d, I, a2] = unique( a) Bruno
|
Pages: 1 Prev: find same values in two tables Next: 'ctranspose' - Error |