def __init__(self, matlab_root=find_matlab_root(), use_jvm=False, use_display=False): """Create a new matlab(tm) wrapper object. """ self._array_cast = None # Specifies a cast for arrays. If the result of an # operation is a numpy array, ``return_type(res)`` will be returned # instead. self._autosync_dirs = True # autosync_dirs specifies whether the working directory of the # matlab session should be kept in sync with that of python. self._flatten_row_vecs = False # Automatically return 1xn matrices as flat numeric arrays. self._flatten_col_vecs = False # Automatically return nx1 matrices as flat numeric arrays. self._clear_call_args = True self._closed = False # Remove the function args from matlab workspace after each function # call. Otherwise they are left to be (partly) overwritten by the next # function call. This saves a function call in matlab but means that the # memory used up by the arguments will remain unreclaimed till # overwritten. cmd_str = os.path.join(matlab_root, 'bin', 'matlab') cmd_str += ' -nodesktop' if not use_jvm: cmd_str += ' -nojvm' if not use_display: cmd_str += ' -nodisplay' self._session = mlabraw.open(cmd_str) atexit.register(self.close) self._proxies = weakref.WeakValueDictionary() # Use ``mlab._proxies.values()`` for a list of matlab object's that # are currently proxied. self._proxy_count = 0 self._mlabraw_can_convert = ('single', 'double', 'char', 'cell', 'struct') # The matlab(tm) types that mlabraw will automatically convert for us. self._dont_proxy = {'cell': False}
if cmp(MATLAB_VERSION, VERSION_7_3) >= 0: DEFINE_MACROS.append(('_V7_3_OR_LATER', 1)) setup( name="mlabwrap", version='1.2', description="A high-level bridge to matlab", author="Alexander Schmolck", author_email="*****@*****.**", url='http://mlabwrap.sourceforge.net', packages=['mlabwrap', 'mlabwrap_utils'], ext_package='mlabwrap', ext_modules=[ get_extension(EXTENSION_NAME, DEFINE_MACROS, MATLAB_LIBRARY_DIRS, MATLAB_LIBRARIES, CPP_LIBRARIES, MATLAB_INCLUDE_DIRS) ], use_2to3=True ) if __name__ == '__main__': # Parse arguments parser = argparse.ArgumentParser() parser.add_argument('--matlab-root', help='The full path to the Matlab root ' 'e.g. /usr/local/MATLAB/R2013a/', default=find_matlab_root()) args = parser.parse_known_args()[0] main(args)