1 | /* |
---|
2 | * ---------------------------------------------------------------------- |
---|
3 | * INTERFACE: Matlab Rappture Library Source |
---|
4 | * |
---|
5 | * [unitsHandle] = rpUnitsGetBasis(unitsHandle) |
---|
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 | |
---|
18 | void mexFunction(int nlhs, mxArray *plhs[], |
---|
19 | int nrhs, const mxArray *prhs[]) |
---|
20 | { |
---|
21 | char *unitSymbol = NULL; |
---|
22 | const RpUnits* myBasis = NULL; |
---|
23 | const RpUnits* myUnit = NULL; |
---|
24 | int retHandle = 0; |
---|
25 | int unitsHandle = 0; |
---|
26 | |
---|
27 | /* Check for proper number of arguments. */ |
---|
28 | if (nrhs != 1) |
---|
29 | mexErrMsgTxt("Two input required."); |
---|
30 | else if (nlhs > 1) |
---|
31 | mexErrMsgTxt("Too many output arguments."); |
---|
32 | |
---|
33 | unitsHandle = getIntInput(prhs[1]); |
---|
34 | |
---|
35 | /* Call the C subroutine. */ |
---|
36 | if (unitsHandle > 0) { |
---|
37 | myUnit = getObject_UnitsStr(unitsHandle); |
---|
38 | |
---|
39 | if (myUnit) { |
---|
40 | |
---|
41 | myBasis = myUnit->getBasis(); |
---|
42 | if (myBasis) { |
---|
43 | retHandle = storeObject_UnitsStr(myBasis->getUnitsName()); |
---|
44 | } |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | /* Set C-style string output_buf to MATLAB mexFunction output*/ |
---|
49 | plhs[0] = mxCreateDoubleScalar(retHandle); |
---|
50 | return; |
---|
51 | } |
---|