%  sa2.m
b=sparse(eye(3));      % sparse b
b(3,2)=20;
d=full(b);             % dense d
a=b                    % copy of b into a
[ind] =find(a)         % column-major ind
[ii jj] = find(a);     % i,j indexes
[ii jj vv]=find(a)     % i,j,val
xnz=nnz(a);            % # nonzeroes
ynz=nonzeros(a);       % what are they
znz=nzmax(a);          % ?
b(3,2)=3
spfun(@exp,b)          % apply exp to b
spfun(@(x) 1./x.^2 ,b) % apply 1/x^2 to b
spy(a)                 % graphics
