From: Bruno Luong on
"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