I am trying to use some existing matlab scripts within the openmdao. The external code tutorial is straight forward to follow. However, I encounter some issues when modifying the following example for matlab applications. original code in tutorial:
self.options['command'] = ['python', 'extcode_paraboloid.py', self.input_file, self.output_file]
modified code for matlab applications:
self.options['command'] = ['matlab', '-nodesktop -r "run Paraboloid.m"', self.input_file, self.output_file]
This line is okay to launch matlab. However, other arguments('-r "test.m "') seems have been truncated and can not be interpreted by matlab correctly. The alternative solution I have is to create another .py file for calling os command.
os.system('cmd /c "matlab -nodesktop -r "run Paraboloid.m",quit"')
Any suggestion on how to call the matlab function directly? Thanks!
Try breaking everything up wherever there is a space.
self.options['command'] = ['matlab', '-nodesktop', '-r', '"run Paraboloid.m"', self.input_file, self.output_file]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With