Run a java program inside Matlab with a input file.
2 views (last 30 days)
Hi, I'm tring to run a java program from a matlab code. I already added the .jar file in the system static variables and I achived to lounch the progam. However I need to use a input file wrote inside matlab as a .txt file (or .dat dosen't matter). I'm using the system function:
system('java -jar mhclasses.jar');
system('java -jar javafoil.jar' );
where i can put the input file?
Kojiro Saito on 7 Dec 2021
Edited: Kojiro Saito on 7 Dec 2021
It might be better to read JavaFoil document.
I'm not familiar with JavaFoil, but it seems that "Script" option allows input files. If you want to input data.txt, try this.
!java.exe -cp "java\mhclasses.jar" -jar "java\javafoil.jar" Script="data.txt"
Alternatively, JavaFoil has embedded sample java code in Embedding and you can use it in MATLAB.
javaFoilPath = "C:\Path\To\MH AeroTools\JavaFoil\java";
jf = JavaFoil;
% Start JavaFoil embedding
% You can input using CreateAirfoil
% It seems that you can input txt file
jf.runScriptLine("Polar.Save('polar.txt')"); % Save the result
% Close JavaFoil embedding
Again, I'm not familiar with JavaFoil, and it is rather JavaFoil specific question than MATLAB, so if you have further question, I think it's better to ask in JavaFoil community.