source: trunk/src/matlab/rpUnitsMakeMetric.cc @ 141

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

added const to RpUnits*'s. these now compile correctly with matlab's mex compiler

File size: 1.4 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    [error] = rpUnitsMakeMetric(basisHandle)
6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
9 *  Copyright (c) 2004-2005  Purdue Research Foundation
10 *
11 *  See the file "license.terms" for information on usage and
12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * ======================================================================
14 */
15
16#include "RpMatlabInterface.h"
17
18void mexFunction(int nlhs, mxArray *plhs[],
19                 int nrhs, const mxArray *prhs[])
20{
21    const RpUnits* basis       = NULL;
22    int            retVal      = 0;
23    int            basisHandle = 0;
24    int            retIndex    = 0;
25
26    /* Check for proper number of arguments. */
27    if (nrhs != 1)
28        mexErrMsgTxt("Two input required.");
29    else if (nlhs > 1)
30        mexErrMsgTxt("Too many output arguments.");
31
32    basisHandle = getIntInput(prhs[0]);
33
34    /* Call the C subroutine. */
35    if (basisHandle > 0) {
36        basis = getObject_UnitsStr(basisHandle);
37
38        if (basis) {
39             retVal = RpUnits::makeMetric(basis);
40        }
41    }
42
43    /* Set C-style string output_buf to MATLAB mexFunction output*/
44    plhs[0] = mxCreateDoubleScalar(retVal);
45
46    return;
47}
Note: See TracBrowser for help on using the repository browser.