Prev: how to plot histogram in 12-bit from an 16-bit image?
Next: Line plot starting at second x axis tick and ...
From: Bruno Luong on 5 Jun 2010 09:28 "Andrei Baskakov" <dronbas(a)yahoo.com> wrote in message <hudg5v$k9p$1(a)fred.mathworks.com>... > Hello! > I have a sparse matrix A, defining an adjency matrix. I need to delete a lot of it's elements. > The way I did it: > IJ = zeros(nnz(A), 2, 'int32'); > [IJ(:,1) IJ(:,2)] = find(A); > > [I1 J1] = [10 20;1 3;....]; % Actually I1,J1 are computed using A. > [IJ] = setdiff(IJ, [I1 J1], 'rows'); You might want to try this tool: http://www.mathworks.com/matlabcentral/fileexchange/23488-sparse-sub-access A=setsparse(A,I1,I1,0); Bruno |