%% Generate Logical Array of Selected Sparsity
% Generate a logical array of the same data type and sparsity as the selected array.

A = logical(sparse(5,3));
whos A

%

F = false(4,'like',A);
whos F

% The output array F has the same sparse attribute as the specified array A.
% Copyright 2012 The MathWorks, Inc.