Running an external program from matlab linux

36 views (last 30 days)
H H
H H on 28 May 2017
Answered: Walter Roberson on 29 May 2017
Hello. I have an external program called Lin.exe. This program accept (read) one file and write to another file. In windows cmd this can be done as follows:
Lin.exe /f command_file.txt /o output_file.txt
In matlab windows, I can do this as:
yourCommand2 = strcat('"C:\Program Files (x86)\Lin.exe"',' /f',' "','command_file.txt, '"', ' /o', ' "','output_file.txt', '"');
system(yourCommand2);
There is a Linux version of this exe file that is ./Lin.exe. The file located in "/global/storage/./Lin.exe". I want to use use matlab in linux to be able to run this program using "unix" command. However, this only can run Lin.exe and does not read any file or write to any file given.
yourCommand=['"/global/storage/./Lin.exe"' ' /f ' '"/home/merakpeep.rwd"' ' /o ' '"test.txt"' ]
unix( yourCommand);
Can you please help on this?
  2 Comments
H H
H H on 28 May 2017
Thank you Walter- It worked with the middle solution you have provided!

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 29 May 2017
Solution: program needed -f and -o flags in Linux instead of the /f and /o flags used in Windows

More Answers (0)

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!