From: Gue Phisan on 24 Feb 2010 07:38 Hi All, I am trying to convert this matrix: A = [0 1 1 0 1;1 1 1 1 0;1 0 1 1 0] to: B = [1 2 2 3 4;2 2 2 2 3;2 5 2 2 3] The value of matrix A is 0 or 1. I need to make variable clusters for the same values and change the values to the index cluster but don't know how to do it. Thanks, GP
From: Steven Lord on 24 Feb 2010 09:39 "Gue Phisan" <dataparman(a)gmail.com> wrote in message news:hm36je$etl$1(a)fred.mathworks.com... > Hi All, > I am trying to convert this matrix: > A = [0 1 1 0 1;1 1 1 1 0;1 0 1 1 0] > to: > B = [1 2 2 3 4;2 2 2 2 3;2 5 2 2 3] > > The value of matrix A is 0 or 1. I need to make variable clusters for the > same values and change the values to the index cluster but don't know how > to do it. Use BWLABEL, first on A then on 1-A. Combine the two results by filling in the zeros in one of them with the nonzeros (appropriately scaled) from the other. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Pages: 1 Prev: sub-pixel shifting of a matrix Next: Add a plane to a surface plot |