finished mex code for reading experimental setup