Changeset 154 for trunk/src/matlab
- Timestamp:
- Jan 11, 2006, 3:55:15 PM (19 years ago)
- Location:
- trunk/src/matlab
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/matlab/rpLib.cc
r115 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * libHandle= rpLib(fileName)5 * [libHandle,err] = rpLib(fileName) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [libHandle,err] = rpLib (fileName) 20 /// Opens a Rappture Library Object based on the xml file 'fileName'. 21 /** 22 * Usually called in the beginning of a program to load an xml file 23 * for future reading. 24 */ 25 18 26 void mexFunction(int nlhs, mxArray *plhs[], 19 27 int nrhs, const mxArray *prhs[]) … … 22 30 RpLibrary* lib = NULL; 23 31 int libIndex = 0; 32 int err = 1; 24 33 25 34 /* Check for proper number of arguments. */ … … 34 43 if (path) { 35 44 lib = rpLibrary(path); 45 if (lib) { 46 err = 0; 47 } 36 48 } 37 49 … … 39 51 /* Set C-style string output_buf to MATLAB mexFunction output*/ 40 52 plhs[0] = mxCreateDoubleScalar(libIndex); 53 plhs[1] = mxCreateDoubleScalar(err); 41 54 42 55 return; -
trunk/src/matlab/rpLibChildren.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * nodeHandle= rpLibChildren(libHandle,path,prevNodeHandle)5 * [nodeHandle,err] = rpLibChildren(libHandle,path,prevNodeHandle) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [nodeHandle,err] = rpLibChildren(libHandle,path,prevNodeHandle) 20 /// Retrieve the children of the node described by 'path' 21 /** 22 * This method searches the Rappture Library Object 'libHandle' for the 23 * node at the location described by the path 'path' and returns its 24 * children. If 'prevNodeHandle' = 0, then the` 25 * first child is returned, else, the next child is retrieved. 26 * If 'prevNodeHandle' is an invalid child handle, an error will be returned. 27 * Subsequent calls to rpLibChildren() should use previously` 28 * returned 'nodeHandle's for it 'prevNodeHandle' argument. 29 * Error code, err=0 on success, anything else is failure. 30 */ 31 32 18 33 void mexFunction(int nlhs, mxArray *plhs[], 19 34 int nrhs, const mxArray *prhs[]) … … 22 37 int childIndex = 0; 23 38 int retLibIndex = 0; 39 int err = 1; 24 40 RpLibrary* lib = NULL; 25 41 RpLibrary* child = NULL; … … 30 46 if (nrhs != 3) 31 47 mexErrMsgTxt("Three input required."); 32 else if (nlhs > 1)48 else if (nlhs > 2) 33 49 mexErrMsgTxt("Too many output arguments."); 34 50 … … 48 64 retLib = rpChildren(lib,path,child); 49 65 retLibIndex = storeObject_Lib(retLib); 66 if (retLibIndex) { 67 err = 0; 68 } 50 69 } 51 70 } … … 53 72 /* Set double scalar node handle to MATLAB mexFunction output*/ 54 73 plhs[0] = mxCreateDoubleScalar(retLibIndex); 74 plhs[1] = mxCreateDoubleScalar(err); 55 75 56 76 return; -
trunk/src/matlab/rpLibChildrenByType.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * nodeHandle= rpLibChildrenByType(libHandle,path,prevNodeHandle,type)5 * [nodeHandle,err] = rpLibChildrenByType(libHandle,path,prevNodeHandle,type) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [nodeHandle,err] = rpLibChildrenByType(libHandle,path,prevNodeHandle,type) 20 /// Retrieve the children of the node described by 'path' of type 'type' 21 /** 22 * This method searches the Rappture Library Object 'libHandle' for the 23 * node at the location described by the path 'path' and returns its 24 * children that match the type 'type'. If 'prevNodeHandle' = 0, then the` 25 * first child is returned, else, the next child is retrieved. 26 * If 'prevNodeHandle' is an invalid child handle, an error will be returned. 27 * Subsequent calls to rpLibChildrenByType() should use previously` 28 * returned 'nodeHandle's for it 'prevNodeHandle' argument. 29 * Error code, err=0 on success, anything else is failure. 30 */ 31 32 18 33 void mexFunction(int nlhs, mxArray *plhs[], 19 34 int nrhs, const mxArray *prhs[]) … … 22 37 int childIndex = 0; 23 38 int retLibIndex = 0; 39 int err = 1; 24 40 RpLibrary* lib = NULL; 25 41 RpLibrary* child = NULL; … … 31 47 if (nrhs != 4) 32 48 mexErrMsgTxt("Four input required."); 33 else if (nlhs > 1)49 else if (nlhs > 2) 34 50 mexErrMsgTxt("Too many output arguments."); 35 51 … … 50 66 retLib = rpChildrenByType(lib,path,child,type); 51 67 retLibIndex = storeObject_Lib(retLib); 68 if (retLibIndex) { 69 err = 0; 70 } 52 71 } 53 72 } … … 55 74 /* Set double scalar node handle to MATLAB mexFunction output*/ 56 75 plhs[0] = mxCreateDoubleScalar(retLibIndex); 76 plhs[1] = mxCreateDoubleScalar(err); 57 77 58 78 return; -
trunk/src/matlab/rpLibElement.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * nodeHandle= rpLibElement(libHandle,path)5 * [nodeHandle,err] = rpLibElement(libHandle,path) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retVal,err] = rpLibElement(libHandle,path) 20 /// Return a handle to the element at location 'path' in 'libHandle' 21 /** 22 * This method searches the Rappture Library Object 'libHandle' for the 23 * node at the location described by the path 'path' and returns 24 * a handle to it. 25 * 26 * If path is an empty string, the root of the node is used. 'libHandle' 27 * is the handle representing the instance of the RpLibrary object. 28 * Error code, err=0 on success, anything else is failure. 29 */ 30 31 18 32 void mexFunction(int nlhs, mxArray *plhs[], 19 33 int nrhs, const mxArray *prhs[]) … … 21 35 int libIndex = 0; 22 36 int retLibIndex = 0; 37 int err = 1; 23 38 RpLibrary* lib = NULL; 24 39 RpLibrary* retLib = NULL; … … 28 43 if (nrhs != 2) 29 44 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)45 else if (nlhs > 2) 31 46 mexErrMsgTxt("Too many output arguments."); 32 47 … … 40 55 retLib = rpElement(lib,path); 41 56 retLibIndex = storeObject_Lib(retLib); 57 if (retLibIndex) { 58 err = 0; 59 } 42 60 } 43 61 } … … 45 63 /* Set double scalar node handle to MATLAB mexFunction output*/ 46 64 plhs[0] = mxCreateDoubleScalar(retLibIndex); 65 plhs[1] = mxCreateDoubleScalar(err); 47 66 48 67 return; -
trunk/src/matlab/rpLibElementAsComp.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibElementAsComp(lib,path)5 * [retStr,err] = rpLibElementAsComp(lib,path) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibElementAsComp(libHandle,path) 20 /// Return the component name of the element at location 'path' in 'libHandle' 21 /** 22 * This method searches the Rappture Library Object 'libHandle' for the 23 * node at the location described by the path 'path' and returns its 24 * component name, a concatination of the type, id, and index. 25 * If path is an empty string, the root of the node is used. 'libHandle' 26 * is the handle representing the instance of the RpLibrary object. 27 * Error code, err=0 on success, anything else is failure. 28 */ 29 18 30 void mexFunction(int nlhs, mxArray *plhs[], 19 31 int nrhs, const mxArray *prhs[]) … … 21 33 int libIndex = 0; 22 34 int retLibIndex = 0; 35 int err = 0; 23 36 RpLibrary* lib = NULL; 24 37 char* path = NULL; … … 28 41 if (nrhs != 2) 29 42 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)43 else if (nlhs > 2) 31 44 mexErrMsgTxt("Too many output arguments."); 32 45 … … 39 52 if (lib) { 40 53 retStr = rpElementAsComp(lib,path); 54 if (retStr) { 55 err = 0; 56 } 41 57 } 42 58 } … … 44 60 /* Set C-style string output_buf to MATLAB mexFunction output*/ 45 61 plhs[0] = mxCreateString(retStr); 62 plhs[1] = mxCreateDoubleScalar(err); 46 63 47 64 return; -
trunk/src/matlab/rpLibElementAsId.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibElementAsId(lib,path)5 * [retStr,err] = rpLibElementAsId(lib,path) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibElementAsId(libHandle,path) 20 /// Return the id attribute of the element at location 'path' in 'libHandle' 21 /** 22 * This method searches the Rappture Library Object 'libHandle' for the 23 * node at the location described by the path 'path' and returns its 24 * id attribute. 25 * 26 * If path is an empty string, the root of the node is used. 'libHandle' 27 * is the handle representing the instance of the RpLibrary object. 28 * Error code, err=0 on success, anything else is failure. 29 */ 30 18 31 void mexFunction(int nlhs, mxArray *plhs[], 19 32 int nrhs, const mxArray *prhs[]) … … 21 34 int libIndex = 0; 22 35 int retLibIndex = 0; 36 int err = 1; 23 37 RpLibrary* lib = NULL; 24 38 char* path = NULL; … … 28 42 if (nrhs != 2) 29 43 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)44 else if (nlhs > 2) 31 45 mexErrMsgTxt("Too many output arguments."); 32 46 … … 39 53 if (lib) { 40 54 retStr = rpElementAsId(lib,path); 55 if (retStr) { 56 err = 0; 57 } 41 58 } 42 59 } … … 44 61 /* Set C-style string output_buf to MATLAB mexFunction output*/ 45 62 plhs[0] = mxCreateString(retStr); 63 plhs[1] = mxCreateDoubleScalar(err); 46 64 47 65 return; -
trunk/src/matlab/rpLibElementAsObject.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * nodeHandle= rpLibElementAsObject(libHandle,path)5 * [nodeHandle,err] = rpLibElementAsObject(libHandle,path) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibElementAsObject(libHandle,path) 20 /// Return a handle to the element at location 'path' in 'libHandle' 21 /** 22 * This method searches the Rappture Library Object 'libHandle' for the 23 * node at the location described by the path 'path' and returns 24 * a handle to it. 25 * 26 * If path is an empty string, the root of the node is used. 'libHandle' 27 * is the handle representing the instance of the RpLibrary object. 28 * Error code, err=0 on success, anything else is failure. 29 */ 30 18 31 void mexFunction(int nlhs, mxArray *plhs[], 19 32 int nrhs, const mxArray *prhs[]) … … 21 34 int libIndex = 0; 22 35 int retLibIndex = 0; 36 int err = 1; 23 37 RpLibrary* lib = NULL; 24 38 RpLibrary* retLib = NULL; … … 28 42 if (nrhs != 2) 29 43 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)44 else if (nlhs > 2) 31 45 mexErrMsgTxt("Too many output arguments."); 32 46 … … 40 54 retLib = rpElement(lib,path); 41 55 retLibIndex = storeObject_Lib(retLib); 56 if (retLibIndex) { 57 err = 0; 58 } 42 59 } 43 60 } … … 45 62 /* Set double scalar node handle to MATLAB mexFunction output*/ 46 63 plhs[0] = mxCreateDoubleScalar(retLibIndex); 64 plhs[1] = mxCreateDoubleScalar(err); 47 65 48 66 return; -
trunk/src/matlab/rpLibElementAsType.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibElementAsType(lib,path)5 * [retStr,err] = rpLibElementAsType(lib,path) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibElementAsType(libHandle,path) 20 /// Return the type name of the element at location 'path' in 'libHandle' 21 /** 22 * This method searches the Rappture Library Object 'libHandle' for the 23 * node at the location described by the path 'path' and returns its 24 * type name. 25 * 26 * If path is an empty string, the root of the node is used. 'libHandle' 27 * is the handle representing the instance of the RpLibrary object. 28 * Error code, err=0 on success, anything else is failure. 29 */ 30 18 31 void mexFunction(int nlhs, mxArray *plhs[], 19 32 int nrhs, const mxArray *prhs[]) … … 21 34 int libIndex = 0; 22 35 int retLibIndex = 0; 36 int err = 1; 23 37 RpLibrary* lib = NULL; 24 38 char* path = NULL; … … 28 42 if (nrhs != 2) 29 43 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)44 else if (nlhs > 2) 31 45 mexErrMsgTxt("Too many output arguments."); 32 46 … … 39 53 if (lib) { 40 54 retStr = rpElementAsType(lib,path); 55 if (retStr) { 56 err = 0; 57 } 41 58 } 42 59 } … … 44 61 /* Set C-style string output_buf to MATLAB mexFunction output*/ 45 62 plhs[0] = mxCreateString(retStr); 63 plhs[1] = mxCreateDoubleScalar(err); 46 64 47 65 return; -
trunk/src/matlab/rpLibGet.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibGet(libHandle,path)5 * [retStr,err] = rpLibGet(libHandle,path) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibGet(libHandle,path) 20 /// Query the value of a node. 21 /** 22 * Clients use this to query the value of a node. If the path 23 * is not specified, it returns the value associated with the 24 * root node. Otherwise, it returns the value for the element 25 * specified by the path. Values are returned as strings. 26 * 27 * Error code, err=0 on success, anything else is failure. 28 */ 29 18 30 void mexFunction(int nlhs, mxArray *plhs[], 19 31 int nrhs, const mxArray *prhs[]) … … 21 33 int libIndex = 0; 22 34 int retLibIndex = 0; 35 int err = 1; 23 36 RpLibrary* lib = NULL; 24 37 char* path = NULL; … … 28 41 if (nrhs != 2) 29 42 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)43 else if (nlhs > 2) 31 44 mexErrMsgTxt("Too many output arguments."); 32 45 … … 40 53 if (lib) { 41 54 retString = rpGet(lib,path); 55 if (retString) { 56 err = 0; 57 } 42 58 } 43 59 } … … 45 61 /* Set C-style string output_buf to MATLAB mexFunction output*/ 46 62 plhs[0] = mxCreateString(retString); 63 plhs[1] = mxCreateDoubleScalar(err); 47 64 48 65 return; -
trunk/src/matlab/rpLibGetDouble.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * nodeHandle= rpLibGetDouble(libHandle,path)5 * [nodeHandle,err] = rpLibGetDouble(libHandle,path) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibGetDouble(libHandle,path) 20 /// Query the value of a node. 21 /** 22 * Clients use this to query the value of a node. If the path 23 * is not specified, it returns the value associated with the 24 * root node. Otherwise, it returns the value for the element 25 * specified by the path. The return value is returned as a double. 26 * 27 * Error code, err=0 on success, anything else is failure. 28 */ 29 18 30 void mexFunction(int nlhs, mxArray *plhs[], 19 31 int nrhs, const mxArray *prhs[]) … … 21 33 int libIndex = 0; 22 34 int retLibIndex = 0; 35 int err = 1; 23 36 RpLibrary* lib = NULL; 24 37 char* path = NULL; … … 28 41 if (nrhs != 2) 29 42 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)43 else if (nlhs > 2) 31 44 mexErrMsgTxt("Too many output arguments."); 32 45 … … 40 53 if (lib) { 41 54 retVal = rpGetDouble(lib,path); 55 err = 0; 42 56 } 43 57 } … … 45 59 /* Set double scalar to MATLAB mexFunction output*/ 46 60 plhs[0] = mxCreateDoubleScalar(retVal); 61 plhs[1] = mxCreateDoubleScalar(err); 47 62 48 63 return; -
trunk/src/matlab/rpLibGetString.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibGetString(libHandle,path)5 * [retStr,err] = rpLibGetString(libHandle,path) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibGetString(libHandle,path) 20 /// Query the value of a node. 21 /** 22 * Clients use this to query the value of a node. If the path 23 * is not specified, it returns the value associated with the 24 * root node. Otherwise, it returns the value for the element 25 * specified by the path. Values are returned as strings. 26 * 27 * Error code, err=0 on success, anything else is failure. 28 */ 29 18 30 void mexFunction(int nlhs, mxArray *plhs[], 19 31 int nrhs, const mxArray *prhs[]) … … 21 33 int libIndex = 0; 22 34 int retLibIndex = 0; 35 int err = 1; 23 36 RpLibrary* lib = NULL; 24 37 char* path = NULL; … … 28 41 if (nrhs != 2) 29 42 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)43 else if (nlhs > 2) 31 44 mexErrMsgTxt("Too many output arguments."); 32 45 … … 40 53 if (lib) { 41 54 retString = rpGetString(lib,path); 55 if (retString) { 56 err = 0; 57 } 42 58 } 43 59 } … … 45 61 /* Set C-style string output_buf to MATLAB mexFunction output*/ 46 62 plhs[0] = mxCreateString(retString); 63 plhs[1] = mxCreateDoubleScalar(err); 47 64 48 65 return; -
trunk/src/matlab/rpLibNodeComp.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibNodeComp(nodeHandle)5 * [retStr,err] = rpLibNodeComp(nodeHandle) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibNodeComp(nodeHandle) 20 /// Return the component name of the node represented by 'nodeHandle' 21 /** 22 * This method returns the component name of the node represented` 23 * by 'nodeHandle'. The component name is a concatination of the`` 24 * type, id, and index. 25 * Error code, err=0 on success, anything else is failure. 26 */ 27 18 28 void mexFunction(int nlhs, mxArray *plhs[], 19 29 int nrhs, const mxArray *prhs[]) … … 21 31 const char *output_buf; 22 32 int libIndex = 0; 33 int err = 1; 23 34 RpLibrary* lib = NULL; 24 35 … … 26 37 if (nrhs != 1) 27 38 mexErrMsgTxt("One input required."); 28 else if (nlhs > 1)39 else if (nlhs > 2) 29 40 mexErrMsgTxt("Too many output arguments."); 30 41 … … 37 48 if (lib) { 38 49 output_buf = rpNodeComp(lib); 50 if (output_buf) { 51 err = 0; 52 } 39 53 } 40 54 } … … 42 56 /* Set C-style string output_buf to MATLAB mexFunction output*/ 43 57 plhs[0] = mxCreateString(output_buf); 58 plhs[1] = mxCreateDoubleScalar(err); 44 59 45 60 return; -
trunk/src/matlab/rpLibNodeId.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibNodeId(lib)5 * [retStr,err] = rpLibNodeId(lib) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibNodeId(nodeHandle) 20 /// Return the id name of the node represented by 'nodeHandle' 21 /** 22 * This method returns the id name of the node represented` 23 * by 'nodeHandle'. 24 * Error code, err=0 on success, anything else is failure. 25 */ 26 18 27 void mexFunction(int nlhs, mxArray *plhs[], 19 28 int nrhs, const mxArray *prhs[]) … … 21 30 const char *output_buf; 22 31 int libIndex = 0; 32 int err = 1; 23 33 RpLibrary* lib = NULL; 24 34 … … 26 36 if (nrhs != 1) 27 37 mexErrMsgTxt("One input required."); 28 else if (nlhs > 1)38 else if (nlhs > 2) 29 39 mexErrMsgTxt("Too many output arguments."); 30 40 … … 37 47 if (lib) { 38 48 output_buf = rpNodeId(lib); 49 if (output_buf) { 50 err = 0; 51 } 39 52 } 40 53 } … … 42 55 /* Set C-style string output_buf to MATLAB mexFunction output*/ 43 56 plhs[0] = mxCreateString(output_buf); 57 plhs[1] = mxCreateDoubleScalar(err); 44 58 45 59 return; -
trunk/src/matlab/rpLibNodeType.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibNodeType(lib)5 * [retStr,err] = rpLibNodeType(lib) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibNodeType(nodeHandle) 20 /// Return the type name of the node represented by 'nodeHandle' 21 /** 22 * This method returns the type name of the node represented` 23 * by 'nodeHandle'. 24 * Error code, err=0 on success, anything else is failure. 25 */ 26 27 18 28 void mexFunction(int nlhs, mxArray *plhs[], 19 29 int nrhs, const mxArray *prhs[]) … … 21 31 const char *output_buf; 22 32 int libIndex = 0; 33 int err = 1; 23 34 RpLibrary* lib = NULL; 24 35 … … 26 37 if (nrhs != 1) 27 38 mexErrMsgTxt("One input required."); 28 else if (nlhs > 1)39 else if (nlhs > 2) 29 40 mexErrMsgTxt("Too many output arguments."); 30 41 … … 37 48 if (lib) { 38 49 output_buf = rpNodeType(lib); 50 if (output_buf) { 51 err = 0; 52 } 39 53 } 40 54 } … … 42 56 /* Set C-style string output_buf to MATLAB mexFunction output*/ 43 57 plhs[0] = mxCreateString(output_buf); 58 plhs[1] = mxCreateDoubleScalar(err); 44 59 45 60 return; -
trunk/src/matlab/rpLibPut.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * rpLibPut(libHandle,path,value,id,append)5 * [err] = rpLibPut(libHandle,path,value,id,append) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [err] = rpLibPut (libHandle,path,value,id,append) 20 /// Set the value of a node. 21 /** 22 * Clients use this to set the value of a node. If the path 23 * is not specified, it sets the value for the root node. 24 * Otherwise, it sets the value for the element specified 25 * by the path. The value is treated as the text within the` 26 * tag at the tail of the path. 27 * 28 * 'id' is used to set the identifier field for the tag at the` 29 * tail of the path. If the append flag is set to 1, then the` 30 * value is appended to the current value. Otherwise, the` 31 * value specified in the function call replaces the current value. 32 * 33 */ 34 18 35 void mexFunction(int nlhs, mxArray *plhs[], 19 36 int nrhs, const mxArray *prhs[]) … … 21 38 int libIndex = 0; 22 39 int append = 0; 40 int err = 1; 23 41 RpLibrary* lib = NULL; 24 42 RpLibrary* retLib = NULL; … … 30 48 if (nrhs != 5) 31 49 mexErrMsgTxt("Two input required."); 32 else if (nlhs > 0)50 else if (nlhs > 1) 33 51 mexErrMsgTxt("Too many output arguments."); 34 52 … … 45 63 if (lib) { 46 64 rpPut(lib,path,value,id,append); 65 err = 0; 47 66 } 48 67 } 49 68 69 plhs[0] = mxCreateDoubleScalar(err); 70 50 71 return; 51 72 } -
trunk/src/matlab/rpLibPutDouble.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * rpLibPutDouble(libHandle,path,value,append)5 * [err] = rpLibPutDouble(libHandle,path,value,append) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [err] = rpLibPutDouble (libHandle,path,value,append) 20 /// Set the value of a node. 21 /** 22 * Clients use this to set the value of a node. If the path 23 * is not specified, it sets the value for the root node. 24 * Otherwise, it sets the value for the element specified 25 * by the path. The value is treated as the text within the` 26 * tag at the tail of the path. 27 * 28 * If the append flag is set to 1, then the` 29 * value is appended to the current value. Otherwise, the` 30 * value specified in the function call replaces the current value. 31 * 32 */ 33 34 18 35 void mexFunction(int nlhs, mxArray *plhs[], 19 36 int nrhs, const mxArray *prhs[]) … … 21 38 int libIndex = 0; 22 39 int append = 0; 40 int err = 1; 23 41 RpLibrary* lib = NULL; 24 42 RpLibrary* retLib = NULL; … … 29 47 if (nrhs != 4) 30 48 mexErrMsgTxt("Two input required."); 31 else if (nlhs > 0)49 else if (nlhs > 1) 32 50 mexErrMsgTxt("Too many output arguments."); 33 51 … … 35 53 path = getStringInput(prhs[1]); 36 54 value = getDoubleInput(prhs[2]); 37 append = getIntInput(prhs[ 4]);55 append = getIntInput(prhs[3]); 38 56 39 57 /* Call the C subroutine. */ … … 42 60 if (lib) { 43 61 rpPutDouble(lib,path,value,append); 62 err = 0; 44 63 } 45 64 } 46 65 66 plhs[0] = mxCreateDoubleScalar(err); 67 47 68 return; 48 69 } -
trunk/src/matlab/rpLibPutDoubleId.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * rpLibPutDoubleId(libHandle,path,value,id,append)5 * [err] = rpLibPutDoubleId(libHandle,path,value,id,append) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [err] = rpLibPutDoubleId (libHandle,path,value,id,append) 20 /// Set the value of a node. 21 /** 22 * Clients use this to set the value of a node. If the path 23 * is not specified, it sets the value for the root node. 24 * Otherwise, it sets the value for the element specified 25 * by the path. The value is treated as the text within the` 26 * tag at the tail of the path. 27 * 28 * 'id' is used to set the identifier field for the tag at the` 29 * tail of the path. If the append flag is set to 1, then the` 30 * value is appended to the current value. Otherwise, the` 31 * value specified in the function call replaces the current value. 32 * 33 */ 34 18 35 void mexFunction(int nlhs, mxArray *plhs[], 19 36 int nrhs, const mxArray *prhs[]) … … 21 38 int libIndex = 0; 22 39 int append = 0; 40 int err = 1; 23 41 RpLibrary* lib = NULL; 24 42 RpLibrary* retLib = NULL; … … 30 48 if (nrhs != 5) 31 49 mexErrMsgTxt("Two input required."); 32 else if (nlhs > 0)50 else if (nlhs > 1) 33 51 mexErrMsgTxt("Too many output arguments."); 34 52 … … 45 63 if (lib) { 46 64 rpPutDoubleId(lib,path,value,id,append); 65 err = 0; 47 66 } 48 67 } 49 68 69 plhs[0] = mxCreateDoubleScalar(err); 70 50 71 return; 51 72 } -
trunk/src/matlab/rpLibPutString.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * rpLibPutString(libHandle,path,value,append)5 * [err] = rpLibPutString(libHandle,path,value,append) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [err] = rpLibPutString (libHandle,path,value,append) 20 /// Set the value of a node. 21 /** 22 * Clients use this to set the value of a node. If the path 23 * is not specified, it sets the value for the root node. 24 * Otherwise, it sets the value for the element specified 25 * by the path. The value is treated as the text within the` 26 * tag at the tail of the path. 27 * 28 * If the append flag is set to 1, then the` 29 * value is appended to the current value. Otherwise, the` 30 * value specified in the function call replaces the current value. 31 * 32 */ 33 18 34 void mexFunction(int nlhs, mxArray *plhs[], 19 35 int nrhs, const mxArray *prhs[]) … … 21 37 int libIndex = 0; 22 38 int append = 0; 39 int err = 1; 23 40 RpLibrary* lib = NULL; 24 41 RpLibrary* retLib = NULL; … … 29 46 if (nrhs != 4) 30 47 mexErrMsgTxt("Two input required."); 31 else if (nlhs > 0)48 else if (nlhs > 1) 32 49 mexErrMsgTxt("Too many output arguments."); 33 50 … … 43 60 if (lib) { 44 61 rpPutString(lib,path,value,append); 62 err = 0; 45 63 } 46 64 } 47 65 66 plhs[0] = mxCreateDoubleScalar(err); 67 48 68 return; 49 69 } -
trunk/src/matlab/rpLibPutStringId.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * rpLibPutStringId(libHandle,path,value,id,append)5 * [err] = rpLibPutStringId(libHandle,path,value,id,append) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [err] = rpLibPutStringId (libHandle,path,value,id,append) 20 /// Set the value of a node. 21 /** 22 * Clients use this to set the value of a node. If the path 23 * is not specified, it sets the value for the root node. 24 * Otherwise, it sets the value for the element specified 25 * by the path. The value is treated as the text within the` 26 * tag at the tail of the path. 27 * 28 * 'id' is used to set the identifier field for the tag at the` 29 * tail of the path. If the append flag is set to 1, then the` 30 * value is appended to the current value. Otherwise, the` 31 * value specified in the function call replaces the current value. 32 * 33 */ 34 35 18 36 void mexFunction(int nlhs, mxArray *plhs[], 19 37 int nrhs, const mxArray *prhs[]) … … 21 39 int libIndex = 0; 22 40 int append = 0; 41 int err = 0; 23 42 RpLibrary* lib = NULL; 24 43 RpLibrary* retLib = NULL; … … 30 49 if (nrhs != 5) 31 50 mexErrMsgTxt("Two input required."); 32 else if (nlhs > 0)51 else if (nlhs > 1) 33 52 mexErrMsgTxt("Too many output arguments."); 34 53 … … 45 64 if (lib) { 46 65 rpPutStringId(lib,path,value,id,append); 66 err = 0; 47 67 } 48 68 } 49 69 70 plhs[0] = mxCreateDoubleScalar(err); 71 50 72 return; 51 73 } -
trunk/src/matlab/rpLibResult.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * rpLibResult(lib)5 * [err] = rpLibResult(lib) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [err] = rpLibResult (libHandle) 20 /// Write Rappture Library to run.xml and signal end of processing. 21 /** 22 * Usually the last call of the program, this function signals to the gui 23 * that processing has completed and the output is ready to be 24 * displayed 25 */ 26 18 27 void mexFunction(int nlhs, mxArray *plhs[], 19 28 int nrhs, const mxArray *prhs[]) 20 29 { 21 const char *output_buf;22 30 int libIndex = 0; 31 int err = 1; 23 32 RpLibrary* lib = NULL; 24 33 … … 26 35 if (nrhs != 1) 27 36 mexErrMsgTxt("One input required."); 28 else if (nlhs > 0)37 else if (nlhs > 1) 29 38 mexErrMsgTxt("Too many output arguments."); 30 39 … … 37 46 if (lib) { 38 47 rpResult(lib); 48 err = 0; 39 49 // cleanLibDict(); 40 50 } 41 51 } 42 52 43 /* Set C-style string output_buf to MATLAB mexFunction output*/ 44 plhs[0] = mxCreateString(output_buf); 53 plhs[0] = mxCreateDoubleScalar(err); 45 54 46 55 return; -
trunk/src/matlab/rpLibXml.cc
r135 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * retStr= rpLibXml(lib)5 * [retStr,err] = rpLibXml(lib) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpLibXml (libHandle) 20 /// Returns the xml from the Rappture Object represented by 'libHandle'. 21 /** 22 * Usually called by user when they need to retrieve the character` 23 * representation of the xml being stored in the Rappture Library Object 24 * Error code, err=0 on success, anything else is failure. 25 */ 26 18 27 void mexFunction(int nlhs, mxArray *plhs[], 19 28 int nrhs, const mxArray *prhs[]) … … 21 30 const char* output_buf = NULL; 22 31 int libIndex = 0; 32 int err = 1; 23 33 RpLibrary* lib = NULL; 24 34 … … 26 36 if (nrhs != 1) 27 37 mexErrMsgTxt("One input required."); 28 else if (nlhs > 1)38 else if (nlhs > 2) 29 39 mexErrMsgTxt("Too many output arguments."); 30 40 … … 37 47 if (lib) { 38 48 output_buf = rpXml(lib); 49 if (output_buf) { 50 err = 0; 51 } 39 52 } 40 53 } … … 42 55 /* Set C-style string output_buf to MATLAB mexFunction output*/ 43 56 plhs[0] = mxCreateString(output_buf); 57 plhs[1] = mxCreateDoubleScalar(err); 44 58 45 59 return; -
trunk/src/matlab/rpUnitsConvert.cc
r135 r154 15 15 16 16 #include "RpMatlabInterface.h" 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpUnitsConvert(fromVal,toUnitsName,showUnits) 20 /// Convert between RpUnits return a string value with or without units 21 /** 22 * Convert the value and units in the string @var{fromVal} to units specified 23 * in string @var{toUnitsName}. If @var{showUnits} is set to 1, then show the 24 * units in the returned string @var{retStr}, else leave the units off. 25 * The second return value @var{err} specifies whether there was an error 26 * during conversion. 27 * Error code, err=0 on success, anything else is failure. 28 */ 17 29 18 30 void mexFunction(int nlhs, mxArray *plhs[], -
trunk/src/matlab/rpUnitsConvertDbl.cc
r135 r154 15 15 16 16 #include "RpMatlabInterface.h" 17 18 /**********************************************************************/ 19 // METHOD: [retVal,err] = rpUnitsConvertDbl(fromVal,toUnitsName) 20 /// Convert between RpUnits return a double value without units 21 /** 22 * Convert the value and units in the string @var{fromVal} to units specified 23 * in string @var{toUnitsName}. Units will not be shown in @var{retVal}. 24 * The second return value @var{err} specifies whether there was an error 25 * during conversion. 26 * Error code, err=0 on success, anything else is failure. 27 */ 17 28 18 29 void mexFunction(int nlhs, mxArray *plhs[], -
trunk/src/matlab/rpUnitsConvertObjDbl.cc
r141 r154 15 15 16 16 #include "RpMatlabInterface.h" 17 18 /**********************************************************************/ 19 // METHOD: [retVal,err] = rpUnitsConvertObjDbl(fromObjHandle,toObjHandle,value) 20 /// Convert between RpUnits return a double value without units 21 /** 22 * Convert @var{value} from the units represented by the RpUnits object 23 * @var{fromObjHandle} to the units represented by the RpUnits object 24 * @var{toObjHandle}. On success, the converted value is returned through 25 * @var{retVal}. The second return value, @var{err}, specifies whether` 26 * there was an error during conversion. 27 * Error code, err=0 on success, anything else is failure. 28 */ 17 29 18 30 void mexFunction(int nlhs, mxArray *plhs[], -
trunk/src/matlab/rpUnitsConvertObjStr.cc
r141 r154 16 16 17 17 #include "RpMatlabInterface.h" 18 19 /**********************************************************************/ 20 // METHOD: [retStr,err] = rpUnitsConvertObjStr(fromObjHandle,toObjHandle,value,showUnits) 21 /// Convert between RpUnits return a string value with or without units 22 /** 23 * Convert @var{value} from the units represented by the RpUnits object 24 * @var{fromObjHandle} to the units represented by the RpUnits object 25 * @var{toObjHandle}. If @var{showUnits} is set to 0, no units will be 26 * displayed in @var{retStr}, else units are displayed.` 27 * On success, the converted value is returned through 28 * @var{retStr}. The second return value, @var{err}, specifies whether` 29 * there was an error during conversion. 30 * Error code, err=0 on success, anything else is failure. 31 */ 18 32 19 33 void mexFunction(int nlhs, mxArray *plhs[], -
trunk/src/matlab/rpUnitsConvertStr.cc
r135 r154 15 15 16 16 #include "RpMatlabInterface.h" 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpUnitsConvertStr(fromVal,toUnitsName,showUnits) 20 /// Convert between RpUnits return a string value with or without units 21 /** 22 * Convert the value and units in the string @var{fromVal} to units specified 23 * in string @var{toUnitsName}. If @var{showUnits} is set to 1, then show the 24 * units in the returned string @var{retStr}, else leave the units off. 25 * The second return value @var{err} specifies whether there was an error 26 * during conversion. 27 * Error code, err=0 on success, anything else is failure. 28 */ 17 29 18 30 void mexFunction(int nlhs, mxArray *plhs[], -
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; -
trunk/src/matlab/rpUnitsFind.cc
r141 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * [unitsHandle ] = rpUnitsFind(unitSymbol)5 * [unitsHandle,err] = rpUnitsFind(unitSymbol) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [unitHandle,err] = rpUnitsFind(unitSymbol) 20 /// Search the dictionary of Rappture Units for an instance named 'unitSymbol' 21 /** 22 * This method searches the Rappture Units Dictionary for the 23 * RpUnit named 'unitSymbol'. If it is found, its handle is` 24 * returned, as a non-negative integer, to the caller for further use, 25 * else a negative integer is returned signifying no unit of that` 26 * name was found. 27 * If unitSymbol is an empty string, unitHandle will be set to zero and err 28 * will be set to a positive value. 29 * Error code, err=0 on success, anything else is failure. 30 */ 31 18 32 void mexFunction(int nlhs, mxArray *plhs[], 19 33 int nrhs, const mxArray *prhs[]) … … 22 36 const RpUnits* myUnit = NULL; 23 37 int retHandle = 0; 38 int err = 1; 24 39 25 40 /* Check for proper number of arguments. */ 26 41 if (nrhs != 1) 27 42 mexErrMsgTxt("Two input required."); 28 else if (nlhs > 1)43 else if (nlhs > 2) 29 44 mexErrMsgTxt("Too many output arguments."); 30 45 … … 37 52 if (myUnit) { 38 53 retHandle = storeObject_UnitsStr(myUnit->getUnitsName()); 54 if (retHandle) { 55 err = 0; 56 } 39 57 } 40 58 } … … 42 60 /* Set C-style string output_buf to MATLAB mexFunction output*/ 43 61 plhs[0] = mxCreateDoubleScalar(retHandle); 62 plhs[1] = mxCreateDoubleScalar(err); 44 63 45 64 return; -
trunk/src/matlab/rpUnitsGetBasis.cc
r141 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * [unitsHandle ] = rpUnitsGetBasis(unitsHandle)5 * [unitsHandle,err] = rpUnitsGetBasis(unitsHandle) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [basisHandle,err] = rpUnitsGetBasis(unitHandle) 20 /// Return a handle to the basis of the provided instance of a Rappture Unit. 21 /** 22 * Retrieve the basis of the Rappture Units object with the handle` 23 * 'unitHandle'. Return the handle of the basis if it exists. If there` 24 * is no basis, then return a negative integer. 25 * Error code, err=0 on success, anything else is failure. 26 */ 27 18 28 void mexFunction(int nlhs, mxArray *plhs[], 19 29 int nrhs, const mxArray *prhs[]) … … 24 34 int retHandle = 0; 25 35 int unitsHandle = 0; 36 int err = 1; 26 37 27 38 /* Check for proper number of arguments. */ 28 39 if (nrhs != 1) 29 40 mexErrMsgTxt("Two input required."); 30 else if (nlhs > 1)41 else if (nlhs > 2) 31 42 mexErrMsgTxt("Too many output arguments."); 32 43 33 unitsHandle = getIntInput(prhs[ 1]);44 unitsHandle = getIntInput(prhs[0]); 34 45 35 46 /* Call the C subroutine. */ … … 42 53 if (myBasis) { 43 54 retHandle = storeObject_UnitsStr(myBasis->getUnitsName()); 55 if (retHandle) { 56 err = 0; 57 } 44 58 } 45 59 } … … 48 62 /* Set C-style string output_buf to MATLAB mexFunction output*/ 49 63 plhs[0] = mxCreateDoubleScalar(retHandle); 64 plhs[1] = mxCreateDoubleScalar(err); 50 65 return; 51 66 } -
trunk/src/matlab/rpUnitsGetExponent.cc
r141 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * [ret Str] = rpUnitsGetExponent(unitsHandle)5 * [retVal,err] = rpUnitsGetExponent(unitsHandle) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retVal,err] = rpUnitsGetExponent(unitHandle) 20 /// Return the exponent of the Rappture Unit represented by unitHandle. 21 /** 22 * Retrieve the exponent of the Rappture Units object with the handle` 23 * 'unitHandle'. Return the exponent as a double. 24 * Error code, err=0 on success, anything else is failure. 25 */ 26 18 27 void mexFunction(int nlhs, mxArray *plhs[], 19 28 int nrhs, const mxArray *prhs[]) … … 23 32 const char* retString = NULL; 24 33 double retVal = 0.0; 34 int err = 1; 25 35 26 36 /* Check for proper number of arguments. */ 27 37 if (nrhs != 1) 28 38 mexErrMsgTxt("Two input required."); 29 else if (nlhs > 1)39 else if (nlhs > 2) 30 40 mexErrMsgTxt("Too many output arguments."); 31 41 … … 37 47 if (unitsObj) { 38 48 retVal = unitsObj->getExponent(); 49 err = 0; 39 50 } 40 51 } … … 42 53 /* Set C-style string output_buf to MATLAB mexFunction output*/ 43 54 plhs[0] = mxCreateDoubleScalar(retVal); 55 plhs[1] = mxCreateDoubleScalar(err); 44 56 45 57 return; -
trunk/src/matlab/rpUnitsGetUnits.cc
r141 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * [retStr ] = rpUnitsGetUnits(unitsHandle)5 * [retStr,err] = rpUnitsGetUnits(unitsHandle) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 18 /**********************************************************************/ 19 // METHOD: [retStr,err] = rpUnitsGetUnits(unitHandle) 20 /// Return the units of the Rappture Unit represented by unitHandle. 21 /** 22 * Retrieve the units of the Rappture Units object with the handle` 23 * 'unitHandle'. Note this does not include the exponent. 24 * For units and exponent in one string see rpUnitsGetUnitsName(). 25 * Return the units as a string. 26 * Error code, err=0 on success, anything else is failure. 27 */ 28 18 29 void mexFunction(int nlhs, mxArray *plhs[], 19 30 int nrhs, const mxArray *prhs[]) 20 31 { 21 32 int unitsHandle = 0; 33 int err = 1; 22 34 const RpUnits* unitsObj = NULL; 23 35 const char* retString = NULL; … … 26 38 if (nrhs != 1) 27 39 mexErrMsgTxt("Two input required."); 28 else if (nlhs > 1)40 else if (nlhs > 2) 29 41 mexErrMsgTxt("Too many output arguments."); 30 42 … … 36 48 if (unitsObj) { 37 49 retString = unitsObj->getUnits().c_str(); 50 if (retString) { 51 err = 0; 52 } 38 53 } 39 54 } … … 41 56 /* Set C-style string output_buf to MATLAB mexFunction output*/ 42 57 plhs[0] = mxCreateString(retString); 58 plhs[1] = mxCreateDoubleScalar(err); 43 59 44 60 return; -
trunk/src/matlab/rpUnitsGetUnitsName.cc
r141 r154 3 3 * INTERFACE: Matlab Rappture Library Source 4 4 * 5 * [retStr ] = rpUnitsGetUnitsName(unitsHandle)5 * [retStr,err] = rpUnitsGetUnitsName(unitsHandle) 6 6 * 7 7 * ====================================================================== … … 16 16 #include "RpMatlabInterface.h" 17 17 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 18 28 void mexFunction(int nlhs, mxArray *plhs[], 19 29 int nrhs, const mxArray *prhs[]) 20 30 { 21 31 int unitsHandle = 0; 32 int err = 1; 22 33 const RpUnits* unitsObj = NULL; 23 34 const char* retString = NULL; … … 26 37 if (nrhs != 1) 27 38 mexErrMsgTxt("Two input required."); 28 else if (nlhs > 1)39 else if (nlhs > 2) 29 40 mexErrMsgTxt("Too many output arguments."); 30 41 … … 36 47 if (unitsObj) { 37 48 retString = unitsObj->getUnitsName().c_str(); 49 if (retString) { 50 err = 0; 51 } 38 52 } 39 53 } … … 41 55 /* Set C-style string output_buf to MATLAB mexFunction output*/ 42 56 plhs[0] = mxCreateString(retString); 57 plhs[1] = mxCreateDoubleScalar(err); 43 58 44 59 return; -
trunk/src/matlab/rpUnitsMakeMetric.cc
r141 r154 15 15 16 16 #include "RpMatlabInterface.h" 17 18 /**********************************************************************/ 19 // METHOD: [err] = rpUnitsMakeMetric(basisHandle) 20 /// Create metric extensions for the Rappture Unit referenced by basisHandle 21 /** 22 * Create the metric extensions for the Rappture Unit, referenced` 23 * by basisHandle, within Rappture's internal units dictionary. 24 * Return an error code, err, to specify success or failure. 25 * Error code, err=0 on success, anything else is failure. 26 */ 17 27 18 28 void mexFunction(int nlhs, mxArray *plhs[],
Note: See TracChangeset
for help on using the changeset viewer.