Launching UNIX Terminal using a Matlab script?
1 view (last 30 days)
Show older comments
Is it possible to launch the OS X Terminal and execute commands using a matlab script? I'd like to control a program called Xfoil, which has a DOS-type text console window that I can access through the terminal. I'd like to pass commands to the program through a matlab script and return a final answer. Xfoil is a text based program and its results would be text as well
Pseudo code for what I'm trying to do would look something like this: launch(Terminal)
execute : /Applications/Xfoil.app/Contents/Resources/xfoil -nodesktop
execute : naca 2412
execute : oper
execute : Re 500000
execute : cl 0
return the result to Matlab
Any ideas how I can do this, or if it's even possible?
0 Comments
Answers (1)
Walter Roberson
on 2 Jan 2014
Java Robot Class.
You might also be able to redirect input and output.
fid = fopen('myscript.txt', 'w');
fprintf(fid, 'naca 2412\noper\nRe 500000\ncl 0\n');
fclose(fid);
system('/Applications/Xfoil.app/Contents/Resources/xfoil -nodesktop < myscript.txt > scriptout.txt');
then deal with scriptout.txt
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!