nipype.interfaces.matlab module

Interfaces to run MATLAB scripts.

MatlabCommand

Link to code

Bases: CommandLine

Wrapped executable: matlab.

Interface that runs matlab code

>>> import nipype.interfaces.matlab as matlab
>>> mlab = matlab.MatlabCommand(mfile=False)  # don't write script file
>>> mlab.inputs.script = "which('who')"
>>> out = mlab.run()  
scripta unicode string

M-code to run. Maps to a command-line argument: -r "%s;exit" (position: -1).

argsa unicode string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

logfilea pathlike object or string representing a file

Save matlab output to log. Maps to a command-line argument: -logfile %s.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

nodesktopa boolean

Switch off desktop mode on unix platforms. Maps to a command-line argument: -nodesktop. (Nipype default value: True)

nosplasha boolean

Switch of splash screen. Maps to a command-line argument: -nosplash. (Nipype default value: True)

pathsa list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

postscripta list of items which are any value

Script added after code. (Nipype default value: ['\n,catch ME,', "fprintf(2,'MATLAB code threw an exception:\\n');", "fprintf(2,'%s\\n',ME.message);", "if length(ME.stack) ~= 0, fprintf(2,'File:%s\\nName:%s\\nLine:%d\\n',ME.stack.file,ME.stack.name,ME.stack.line);, end;", 'end;'])

prescripta list of items which are any value

Prescript to be added before code. (Nipype default value: ['ver,', 'try,'])

script_filea pathlike object or string representing a file

Name of file to write m-code to. (Nipype default value: pyscript.m)

single_comp_threada boolean

Force single threaded operation. Maps to a command-line argument: -singleCompThread.

uses_mcra boolean

Use MCR interface. Mutually exclusive with inputs: nodesktop, nosplash, single_comp_thread.

classmethod MatlabCommand.set_default_matlab_cmd(matlab_cmd)

Set the default MATLAB command line for MATLAB classes.

This method is used to set values for all MATLAB subclasses. However, setting this will not update the output type for any existing instances. For these, assign the <instance>.inputs.matlab_cmd.

classmethod MatlabCommand.set_default_mfile(mfile)

Set the default MATLAB script file format for MATLAB classes.

This method is used to set values for all MATLAB subclasses. However, setting this will not update the output type for any existing instances. For these, assign the <instance>.inputs.mfile.

classmethod MatlabCommand.set_default_paths(paths)

Set the default MATLAB paths for MATLAB classes.

This method is used to set values for all MATLAB subclasses. However, setting this will not update the output type for any existing instances. For these, assign the <instance>.inputs.paths.

nipype.interfaces.matlab.get_matlab_command()

Determine whether Matlab is installed and can be executed.