Wednesday, March 26, 2014

Understand the MEX- Matlab file.

This is a extremely good documentation for writing/creating a Mex file.

https://www.dropbox.com/s/374xoubw027m8mg/Understanding_mex_codes.pdf
or
http://classes.soe.ucsc.edu/ee264/Fall11/cmex.pdf



Now, what I understand from a MEX file is that just converting a c++ to "SORT-of" m-file, directly executable by Matlab. Now why we need this is that when we assign call backs to various buttons on the Matlab interface, we need to call these Mexfiles so that your USB will actively participate in changing the configuration of the ICs.

#Question: So do we need so many MEX files for different callbacks? 
Well, it might seem too redundant to keep generating these MEX codes. So the way a MEX function looks like is :
 <include files>
mexFunction( args ){
// local variables that read args.
// save into a specific buffer format based on the IC.
// Open communication with USB and access a particular configuration set in the RAM code for this IC config.
}

#Question: So how do you do serial communication?
That still remains a mystery. Lets give it some time. 
#Question: So are the passed arguments in the RAM file different for all different calls ? How do link?  


Check this file. This is the matlab GUI file :)
https://www.dropbox.com/s/k9gwgboxo4r2gc6/DAQBoard_CODE2.m
to run this: 
guide  DAQBoard_CODE2


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.