MATLAB - npalko/npalko.github.com GitHub Wiki
h2. C API
Interaction with MATLAB environment
|mexPrintf|ANSI C printf-style output routine| |mexWarnMsgIdAndTxt|Issue warning message with identifier| |mexErrMsgIdAndTxt|Issue error message with identifier and return to MATLAB prompt|
Matrix
|mxIsNaN|Determine whether input is NaN (Not-a-Number)| |mxCreateNumericMatrix| | |mxGetPr|Get address of the pointer to the matrix data|
Structures
|mxIsStruct|Determine whether input is structure mxArray| |mxGetNumberOfFields| | |mxGetFieldNameByNumber|Get field name, given field number in structure array| |mxGetFieldByNumber|Get field value, given field number and index into structure array|
h4. Implementation Notes with the C API
- For primitive types, MATLAB automatically converts any argument to the type expected by the external function
- MATLAB automatically converts an argument passed by value into an argument passed by reference when the external function prototype defines the argument as a pointer.
- MATLAB string equivalent to @char *@
- Exported function arguments passed by reference to @calllib()@ functions will appear as output. This is messy, and unfortunate.
h4. Open Questions
- how does the mexFunction(nlhs,mxArray,nrhs,mxArray) functionality translate into calllib()? is it even available? this is interesting since we can explicitly control the number of output parameters
- can we read a nested struct with @calllib()@ if it's presented as a mxArray
h2. Toolboxes
- use 'rehash' to reset toolbox path
- developing in toolbox - functions must be specificly reloaded
C:\Program Files\MATLAB\R2009a
info.xml
mcc.enc
help\toolbox<toolbox>
helpindex.xml
helptoc.xml