[97] | 1 | /* |
---|
| 2 | * ---------------------------------------------------------------------- |
---|
| 3 | * INTERFACE: Matlab Rappture Library Source |
---|
| 4 | * |
---|
[135] | 5 | * nodeHandle = rpLibGetDouble(libHandle,path) |
---|
[97] | 6 | * |
---|
| 7 | * ====================================================================== |
---|
| 8 | * AUTHOR: Derrick Kearney, Purdue University |
---|
[115] | 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. |
---|
[97] | 13 | * ====================================================================== |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #include "RpMatlabInterface.h" |
---|
| 17 | |
---|
| 18 | void mexFunction(int nlhs, mxArray *plhs[], |
---|
| 19 | int nrhs, const mxArray *prhs[]) |
---|
| 20 | { |
---|
| 21 | int libIndex = 0; |
---|
| 22 | int retLibIndex = 0; |
---|
| 23 | RpLibrary* lib = NULL; |
---|
| 24 | char* path = NULL; |
---|
| 25 | double retVal = 0.0; |
---|
| 26 | |
---|
| 27 | /* Check for proper number of arguments. */ |
---|
| 28 | if (nrhs != 2) |
---|
| 29 | mexErrMsgTxt("Two input required."); |
---|
| 30 | else if (nlhs > 1) |
---|
| 31 | mexErrMsgTxt("Too many output arguments."); |
---|
| 32 | |
---|
| 33 | libIndex = getIntInput(prhs[0]); |
---|
| 34 | path = getStringInput(prhs[1]); |
---|
| 35 | |
---|
| 36 | /* Call the C subroutine. */ |
---|
| 37 | if ( (libIndex > 0) && (path) ) { |
---|
| 38 | lib = getObject_Lib(libIndex); |
---|
| 39 | |
---|
| 40 | if (lib) { |
---|
| 41 | retVal = rpGetDouble(lib,path); |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | /* Set double scalar to MATLAB mexFunction output*/ |
---|
| 46 | plhs[0] = mxCreateDoubleScalar(retVal); |
---|
| 47 | |
---|
| 48 | return; |
---|
| 49 | } |
---|