%% Nonzero Matrix Elements
% Use nonzeros to return the nonzero elements in a sparse matrix.
%
% Create a 10-by-10 sparse matrix that contains a few nonzero elements. The typical display of sparse matrices shows a list of the nonzero values and their locations.

A = sparse([1 3 2 1],[1 1 2 3],1:4,10,10)

%
% Find the values of the nonzero elements.

v = nonzeros(A)

% Copyright 2018 The MathWorks, Inc.