Nipype - applying custom spm Matlab toolboxes to pipeline - how to pass arguments to .m function?

Hi,
I am new to Nipype, working on setting up a preprocessing pipeline. Things are running smoothly except I would like to add some preprocessing steps that are not part of the spm interface.
I’ve tried calling the relevant Matlab function from python but I don’t know how to pass the image files to it. My code looks like this right now:

mlab = matlab.MatlabCommand()
mlab.inputs.paths = '/Documents/MATLAB/spm12/toolbox/biasCorrect'
bcPath = '/Documents/MATLAB/spm12/toolbox/biasCorrect/'
bcScr = os.path.join(bcPath, 'bcorrectNP.m')
mlab.inputs.script = bcScr
res = mlab.run()

It runs but doesn’t what it’s supposed to.
I’ve been looking at the following examples but it hasn’t helped:
https://nipype.readthedocs.io/en/latest/devel/matlab_interface_devel.html

Thank you

I am certain there is a better way, but my workaround was to save the args to a csv file in python and open it in the matlab function. Very clunky solution.