source: trunk/src/matlab/rpAddPresets.cc @ 97

Last change on this file since 97 was 97, checked in by dkearney, 18 years ago

adding initial matlab bindings
few minor changes with other listed files

File size: 1.1 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    result = rpAddPresets(presetName)
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    std::string presetName  = "";
20    int result = -1;
21
22    /* Check for proper number of arguments. */
23    if (nrhs != 1)
24        mexErrMsgTxt("Two input required.");
25    else if (nlhs > 1)
26        mexErrMsgTxt("Too many output arguments.");
27
28    presetName = getStringInput(prhs[0]);
29
30    /* Call the C subroutine. */
31    if ( !presetName.empty() ) {
32        result = RpUnits::addPresets(presetName);
33    }
34
35    /* Set output to MATLAB mexFunction output */
36    plhs[0] = mxCreateDoubleScalar((double)result);
37
38    return;
39}
Note: See TracBrowser for help on using the repository browser.