SPARSE Create sparse matrix (EIDORS overload). S = SPARSE(X) converts a sparse or full matrix to sparse form by squeezing out any zero elements. See also SPARFUN/SPARSE Sparse doesn't work for uint* inputs, so we need to preconvert to double
0001 function S = sparse(varargin) 0002 %SPARSE Create sparse matrix (EIDORS overload). 0003 % S = SPARSE(X) converts a sparse or full matrix to sparse form by 0004 % squeezing out any zero elements. 0005 % 0006 % See also SPARFUN/SPARSE 0007 % 0008 % Sparse doesn't work for uint* inputs, so we need to preconvert to double 0009 0010 % (C) 2011 Bartlomiej Grychtol. License: GPL v2 or v3. 0011 % $Id: sparse.m 6413 2022-11-26 20:29:19Z bgrychtol $ 0012 0013 for i= 1:nargin 0014 if ~isa(varargin{i},'double') 0015 varargin{i} = double(varargin{i}); 0016 end 0017 end 0018 S = builtin('sparse',varargin{:});