interfaces.matlab

Module: interfaces.matlab

General matlab interface code

This is for nipy convenience. If you’re doing heavy matlab interfacing, please use NiPype instead:

http://nipy.org/nipype

Functions

nipy.interfaces.matlab.mlab_tempfile(dir=None)

Returns a temporary file-like object with valid matlab name.

The file name is accessible as the .name attribute of the returned object. The caller is responsible for closing the returned object, at which time the underlying file gets deleted from the filesystem.

Parameters:

dir : str

A path to use as the starting directory. Note that this directory must already exist, it is NOT created if it doesn’t (in that case, OSError is raised instead).

Returns:

f : file-like object

Examples

>>> f = mlab_tempfile()
>>> pth, fname = os.path.split(f.name)
>>> '-' not in fname
True
>>> f.close()
nipy.interfaces.matlab.run_matlab(cmd)
nipy.interfaces.matlab.run_matlab_script(script_lines, script_name='pyscript')

Put multiline matlab script into script file and run