Ignore:
Timestamp:
Jan 11, 2006 3:55:15 PM (16 years ago)
Author:
dkearney
Message:

modified matlab bindings and tests.
includes all popular functions available in RpLibrary? and RpUnits
compile and run, but not all tests work as they should
some of these functions will be removed soon because the id field is
no longer a valid argument. path ids should be incorporated in paths from now on.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/matlab/rpUnitsGetUnitsName.cc

    r141 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [retStr] = rpUnitsGetUnitsName(unitsHandle)
     5 *    [retStr,err] = rpUnitsGetUnitsName(unitsHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpUnitsGetUnitsName(unitHandle)
     20/// Return the unit and exponent of the Rappture Unit represented by unitHandle.
     21/**
     22 * Retrieve the unit and exponent of the Rappture Units object with`
     23 * the handle 'unitHandle'.
     24 * Return the unit and exponent as one concatinated string.
     25 * Error code, err=0 on success, anything else is failure.
     26 */
     27
    1828void mexFunction(int nlhs, mxArray *plhs[],
    1929                 int nrhs, const mxArray *prhs[])
    2030{
    2131    int            unitsHandle = 0;
     32    int            err         = 1;
    2233    const RpUnits* unitsObj    = NULL;
    2334    const char*    retString   = NULL;
     
    2637    if (nrhs != 1)
    2738        mexErrMsgTxt("Two input required.");
    28     else if (nlhs > 1)
     39    else if (nlhs > 2)
    2940        mexErrMsgTxt("Too many output arguments.");
    3041
     
    3647        if (unitsObj) {
    3748            retString = unitsObj->getUnitsName().c_str();
     49            if (retString) {
     50                err = 0;
     51            }
    3852        }
    3953    }
     
    4155    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4256    plhs[0] = mxCreateString(retString);
     57    plhs[1] = mxCreateDoubleScalar(err);
    4358
    4459    return;
Note: See TracChangeset for help on using the changeset viewer.