User`s manual

2 Creating C Language MEX-Files
2-14
and so on. Likewise, prhs[0] contains a pointer to the first right-hand side
argument,
prhs[1] points to the second, and so on.
This example,
xtimesy, multiplies an input scalar by an input scalar or matrix
and outputs a matrix. For example, using
xtimesy with two scalars gives
x = 7;
y = 7;
z = xtimesy(x,y)
z =
49
Using xtimesy with a scalar and a matrix gives
x = 9;
y = ones(3);
z = xtimesy(x,y)
z =
9 9 9
9 9 9
9 9 9
This is the corresponding MEX-file C code.
#include "mex.h"
/*
* xtimesy.c - example found in API guide
*
* Multiplies an input scalar times an input matrix and outputs a
* matrix.
*
* This is a MEX-file for MATLAB.
* Copyright (c) 1984-2000 The MathWorks, Inc.
*/
/* $Revision: 1.10 $ */