UPLUS.C
Upload User: jihankui
Upload Date: 2013-03-01
Package Size: 5664k
Code Size: 1k
Development Platform:

Matlab

  1. /* Copyright (c) 1984-98 by The MathWorks, Inc.  */
  2. /* $Revision: 1.4 $ */
  3. /*
  4.  * UPLUS --- overloaded unary plus for uint8 arrays
  5.  *
  6.  * Usage: 
  7.  *
  8.  * >> a = uint8(magic(3));
  9.  * >> b = +a;  % invokes this MEX-file on a
  10.  *
  11.  * Steve Eddins, September 1996
  12.  */
  13. static char rcsid[] = "$Id: uplus.c,v 1.4 1997/11/21 23:39:27 moler Exp $";
  14. #include "mex.h"
  15. /* As of 9 Sep 1996, this define is necessary to prevent */
  16. /* a full data copy.  This line can be removed if the behavior */
  17. /* of the mxClearLogical function changes to use a shared-data copy. */
  18. #define ARRAY_ACCESS_INLINING
  19. void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
  20. {
  21.     if ((nrhs != 1) || !mxIsUint8(prhs[0]))
  22.     {
  23.         mexErrMsgTxt("A single uint8 input was expected");
  24.     }
  25.     plhs[0] = mxDuplicateArray(prhs[0]);
  26.     mxClearLogical(plhs[0]);
  27. }