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
|
Rev | Line | |
---|
[97] | 1 | /* |
---|
| 2 | * ---------------------------------------------------------------------- |
---|
| 3 | * INTERFACE: Matlab Rappture Library Source |
---|
| 4 | * |
---|
| 5 | * unitsHandle = rpFind(unitSymbol) |
---|
| 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 | |
---|
| 16 | void mexFunction(int nlhs, mxArray *plhs[], |
---|
| 17 | int nrhs, const mxArray *prhs[]) |
---|
| 18 | { |
---|
| 19 | char *unitSymbol = NULL; |
---|
| 20 | RpUnits* myUnit = NULL; |
---|
| 21 | int retHandle = 0; |
---|
| 22 | |
---|
| 23 | /* Check for proper number of arguments. */ |
---|
| 24 | if (nrhs != 1) |
---|
| 25 | mexErrMsgTxt("Two input required."); |
---|
| 26 | else if (nlhs > 1) |
---|
| 27 | mexErrMsgTxt("Too many output arguments."); |
---|
| 28 | |
---|
| 29 | unitSymbol = getStringInput(prhs[0]); |
---|
| 30 | |
---|
| 31 | /* Call the C subroutine. */ |
---|
| 32 | if (unitSymbol) { |
---|
| 33 | myUnit = RpUnits::find(unitSymbol); |
---|
| 34 | |
---|
| 35 | if (myUnit) { |
---|
| 36 | retHandle = storeObject_UnitsStr(myUnit->getUnitsName()); |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | /* Set C-style string output_buf to MATLAB mexFunction output*/ |
---|
| 41 | plhs[0] = mxCreateDoubleScalar(retHandle); |
---|
| 42 | |
---|
| 43 | return; |
---|
| 44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.