source: trunk/src/matlab/rpGetExponent.cc @ 97

Last change on this file since 97 was 97, checked in by dkearney, 19 years ago

adding initial matlab bindings
few minor changes with other listed files

File size: 1.2 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    retStr = rpGetExponent(unitsHandle)
6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
9 *  Copyright (c) 2005
10 *  Purdue Research Foundation, West Lafayette, IN
11 * ======================================================================
12 */
13
14#include "RpMatlabInterface.h"
15
16void mexFunction(int nlhs, mxArray *plhs[],
17                 int nrhs, const mxArray *prhs[])
18{
19    int         unitsHandle = 0;
20    RpUnits*    unitsObj    = NULL;
21    const char* retString   = NULL;
22    double      retVal      = 0.0;
23
24    /* Check for proper number of arguments. */
25    if (nrhs != 1)
26        mexErrMsgTxt("Two input required.");
27    else if (nlhs > 1)
28        mexErrMsgTxt("Too many output arguments.");
29
30    unitsHandle = getIntInput(prhs[0]);
31
32    /* Call the C subroutine. */
33    if (unitsHandle > 0) {
34        unitsObj = getObject_UnitsStr(unitsHandle);
35        if (unitsObj) {
36            retVal = unitsObj->getExponent();
37        }
38    }
39
40    /* Set C-style string output_buf to MATLAB mexFunction output*/
41    plhs[0] = mxCreateDoubleScalar(retVal);
42
43    return;
44}
Note: See TracBrowser for help on using the repository browser.