Use
if(!mxIsSparse(prhs[0]))
instead of
if(mxIsFull(prhs[0]))
See Also
mxIsSparse
© 1994-2005 The MathWorks, Inc.