Never mind, I figured it out. However I have a different problem now. I have an m file that computes a certain value which I would like my node to capture. Here is some made-up code that illustrates the problem. How can I specify in my class that the contents of the res variable should be stored in the value output?
class TestInputSpec(BaseInterfaceInputSpec):
out_file = File('test.csv', usedefault=True)
class TestOutputSpec(TraitedSpec):
out_file = File(exists=True)
value= traits.Float()
class Test(BaseInterface):
input_spec = TestInputSpec
output_spec = TestOutputSpec
def _run_interface(self, runtime):
d = dict(out_file=self.inputs.out_file)
script = Template("""
res=2.3+1.3;
csvwrite($out_file,res)
""").substitute(d)
mlab = MatlabCommand(script=script, mfile=True)
result = mlab.run()
return result.runtime
def _list_outputs(self):
outputs = self._outputs().get()
outputs['out_file'] = os.path.abspath(self.inputs.out_file)
***outputs['value'] = ??? #how can I assign the res result from script above to the value output?***
test = Node(Test(), name='test')