Failing to use system() and win 10 bash.exe in Matlab

Viewed 347

I am trying to use the new bash functionally of windows 10 to run a linux program through matlab.

In this particular case it's a program called snaphu that processes an inputfile and generates an outputfile. In linux (or the new bash shell in win10) you would run it like:

snaphu -f configfile inputfile

You can run this command directly in cmd by:

bash -c "snaphu -f configfile inputfile"

This processes the file and generates an output file. I use matlab to make the inputfile and I would like to run snaphu after making that file by using

system('bash -c "snaphu -f configfile inputfile"')

to use matlab to process the output file it generates in one work flow. However using this command I don't get my output file. Appending & does work, however.

system('bash -c "snaphu -f configfile inputfile" &')

The problem with this approach is that I am using a for loop to process roughly 1000 of these inputfiles, each different from the last iteration. If I use the "&" it opens up a new window every time.

I don't understand why it does generate the output file in the latter case, but not the first. Can anyone help me?

0 Answers
Related