source: trunk/src/matlab/rpElement.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.3 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    nodeHandle = rpElement(libHandle,path)
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         libIndex = 0;
20    int         retLibIndex = 0;
21    RpLibrary*  lib = NULL;
22    RpLibrary*  retLib = NULL;
23    char*       path = NULL;
24
25    /* Check for proper number of arguments. */
26    if (nrhs != 2)
27        mexErrMsgTxt("Two input required.");
28    else if (nlhs > 1)
29        mexErrMsgTxt("Too many output arguments.");
30
31    libIndex = getIntInput(prhs[0]);
32    path = getStringInput(prhs[1]);
33
34    /* Call the C subroutine. */
35    if ( (libIndex > 0) && (path) ) {
36        lib = getObject_Lib(libIndex);
37        if (lib) {
38            retLib = rpElement(lib,path);
39            retLibIndex = storeObject_Lib(retLib);
40        }
41    }
42
43    /* Set double scalar node handle to MATLAB mexFunction output*/
44    plhs[0] = mxCreateDoubleScalar(retLibIndex);
45
46    return;
47}
Note: See TracBrowser for help on using the repository browser.