4

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!

Sparkle
  • 43
  • 2

1 Answers1

1

Try breaking everything up wherever there is a space.

self.options['command'] = ['matlab', '-nodesktop', '-r', '"run Paraboloid.m"', self.input_file, self.output_file]

Justin Gray
  • 5,605
  • 1
  • 11
  • 16