Changeset 154 for trunk/src/matlab/rpUnitsDefineUnit.cc
- Timestamp:
- Jan 11, 2006, 3:55:15 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/matlab/rpUnitsDefineUnit.cc
r141 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * [unitsHandle ] = rpUnitsDefineUnit(unitSymbol, basisHandle)5 * [unitsHandle,err] = rpUnitsDefineUnit(unitSymbol, basisHandle) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [unitsHandle,err] = rpUnitsDefineUnit(unitSymbol, basisHandle) 20 /// Define a new Rappture Units type. 21 /** 22 * Define a new Rappture Units type which can be searched for using 23 * @var{unitSymbol} and has a basis of @var{basisHandle}. Because of 24 * the way the Rappture Units module parses unit names, complex units must 25 * be defined as multiple basic units. See the RpUnits Howto for more 26 * information on this topic. A @var{basisHandle} equal to 0 means that 27 * the unit being defined should be considered as a basis. Unit names must 28 * not be empty strings. 29 * 30 * The first return value, @var{unitsHandle} represents the handle of the 31 * instance of the RpUnits object inside the internal dictionary. On 32 * success this value will be greater than zero (0), any other value is 33 * represents failure within the function. The second return value 34 * @var{err} represents the error code returned from the function. 35 * 36 * Error code, err=0 on success, anything else is failure. 37 */ 38 18 39 void mexFunction(int nlhs, mxArray *plhs[], 19 40 int nrhs, const mxArray *prhs[]) … … 25 46 int basisHandle = 0; 26 47 int retIndex = 0; 48 int err = 1; 27 49 28 50 /* Check for proper number of arguments. */ 29 51 if (nrhs != 2) 30 52 mexErrMsgTxt("Two input required."); 31 else if (nlhs > 1)53 else if (nlhs > 2) 32 54 mexErrMsgTxt("Too many output arguments."); 33 55 … … 45 67 if (myUnit) { 46 68 retHandle = storeObject_UnitsStr(myUnit->getUnitsName()); 69 if (retHandle) { 70 err = 0; 71 } 47 72 } 48 73 } … … 50 75 /* Set C-style string output_buf to MATLAB mexFunction output*/ 51 76 plhs[0] = mxCreateDoubleScalar(retHandle); 77 plhs[1] = mxCreateDoubleScalar(err); 52 78 53 79 return;
Note: See TracChangeset
for help on using the changeset viewer.