Running Ansys from Matlab
Mostrar comentarios más antiguos
Hi,
I need to run Ansys from Matlab. I write the code
dos('ansys145 -b -i model2.txt -o output2.txt');
Then I get an error
ansys145 is not recognized as an internal or external command, operable program or batch file.
I try adding "C:\Program Files\ANSYS Inc\v145\ansys\bin\winx64\ANSYS145.exe" as a path to Environmental Variables but the problem is not solved.
13 comentarios
Geoff Hayes
el 20 de Sept. de 2014
What happens if you try running the same command outside of MATLAB, in the DOS/Command window - does that work?
And did you add C:\Program Files\ANSYS Inc\v145\ansys\bin\winx64\ANSYS145.exe to the Environment Path variable, or C:\Program Files\ANSYS Inc\v145\ansys\bin\winx64\ where the latter has just the path to the application and not the application name?
Merve
el 23 de Sept. de 2014
Geoff Hayes
el 23 de Sept. de 2014
It would have been interesting to see if just adding C:\Program Files\ANSYS Inc\v145\ansys\bin\winx64 to the environment PATH would have been sufficient because I think that you typically add paths to this variable and not files or executables (along with their path).
Mohan prasad K S
el 11 de Jul. de 2016
Editada: Walter Roberson
el 12 de Jul. de 2016
Hello Merve & Geoff
I used the code
!"C:\Program Files\ANSYS Inc\v160\ansys\bin\winx64ANSYS160.exe" -b -i C:\Users\cfo1714\python\s3.txt -o C:\Users\cfo1714\python\output.txt
and I also used
dos('"C:\Program Files\ANSYS Inc\v160\ansys\bin\winx64ANSYS160.exe" -b -dir "C:\Users\cfo1714\python" -i "C:\Users\cfo1714\python\s3.txt -o C:\Users\cfo1714\python\output.txt"')
I got the same result, which is
'"C:\Program Files\ANSYS Inc\v160\ansys\bin\winx64ANSYS160.exe"' is not recognized as an internal or external command,
operable program or batch file.
ans =
1
Please help me, in solving the problem
Walter Roberson
el 12 de Jul. de 2016
Mohan prasad K S, you appear to be missing the \ between winx64 and ANSYS160.exe
Check with your Windows Explorer that you are using exactly the same path and file name as your ANSYS executable.
Prakul Mittal
el 25 de En. de 2017
Hi Guys I am facing the same issue
dos( ' "C:\Program Files\ANSYS Inc\v162\ansys\bin\winx64\ANSYS" -b -i C:\New folder\matlabex\ansyscampbell\in.txt -o C:\New folder\matlabex\ansyscampbell\out.txt ');
but ansys is not working, and I am geting ans vaule = -1.0737e+09
can any one help please. thanks
Sorin Munteanu
el 26 de Feb. de 2017
Editada: Walter Roberson
el 26 de Feb. de 2017
Hi Prakul,
I will suggest to use interactive connection between Matlab and ANSYS (aka the ANSYS aaS connection). The link provided by Sarah is a very good start ( MATLAB Apps For ANSYS )
Using ANSYS aaS you will be able start Matlab and ANSYS on two different machines (e.g. Matlab on Windows and ANSYS on Linux) and connect them. You will be able then to issue one command(i.e. one line in your in.txt) at the time and retrieve the output/error for each command.
The approach that you mentioned will implicitly require ANSYS and Matlab running on the same machine, and further more ANSYS will most surely execute in the memory of the Matlab process, therefore it will be applicable only to relative small academic ANSYS simulations. The aaS approach will let you to execute large ANSYS simulation too, e.g. parallel simulations running on multiple compute node on a Linux cluster. On top of thatm with aaS, you do not have to wait for ANSYS simulation to complete and read the output file, but you will be updated by the simulation progress as this is executed.
Sorin
Walter Roberson
el 26 de Feb. de 2017
Prakul, try
dos( ' "C:\Program Files\ANSYS Inc\v162\ansys\bin\winx64\ANSYS" -b -i "C:\New folder\matlabex\ansyscampbell\in.txt" -o "C:\New folder\matlabex\ansyscampbell\out.txt" ');
That is, every path should have "" around it, so that if it happens to have a space in it, dos will not break it up into two arguments.
Prakul Mittal
el 27 de Feb. de 2017
Hi Sorin & Walter,
Thanks for the input.
sina salahshour
el 9 de Nov. de 2022
Hello,
I want to run fluent from matlab and i can't use AAS toolbox because i don't access to it, how can i run multiple times ?
i use it :
! "C:\Program Files\ANSYS Inc\v212\fluent\ntbin\win64\fluent.exe" 2ddp -i "C:\Users\SINA\Desktop\New_folder\15KArms.jou" '
but i want to run again this file by another journal file after finishing the first journal file i mean in following of first journal . How can i do it?
Best Regards,
Walter Roberson
el 9 de Nov. de 2022
exe_path = 'C:\Program Files\ANSYS Inc\v212\fluent\ntbin\win64\fluent.exe';
jou_dir = 'C:\Users\SINA\Desktop\New_folder';
dinfo = dir(jou_dir, '*.jou');
numfiles = length(dinfo);
messages = cell(numfiles, 1);
for K = 1 : numfiles
jou_file = fullfile(dinfo(K).folder, dinfo(K).name);
cmd = sprintf('"%s" 2ddp -i "%s"', exe_path, jou_file);
[status, messages{K}] = system(cmd);
end
sina salahshour
el 10 de Nov. de 2022
Thank you for your response and guidance,It's so helpfull. But I have a problem , i want pop up fluent for one time and then run it by some journal file multiple time in the following of Previous one , i dont want to pop up fluent for every journal file separately, is there any solution for it?
Best regards,
Walter Roberson
el 13 de Jun. de 2023
nice answer, would like to more about that
Respuesta aceptada
Más respuestas (2)
broken_arrow
el 17 de Mayo de 2021
Editada: broken_arrow
el 8 de Oct. de 2021
1 voto
As of today, the provided link
redirects to the Ansys start page. The latest ANSYS_aaS Toolbox I could get is 1.1.9, which officially works until Matlab R2018b. I couldn't get it to work with newer releases and also can't downgrade my Matlab release because I'm using some functionalities of newer releases. Is there any follow-up on this? Has Ansys aaS been discontinued?
3 comentarios
Walter Roberson
el 10 de Oct. de 2021
The blog appears to have moved to
Unfortunately the toolbox they mention there cannot be searched for on their site -- it looks like public and students cannot gain access to the place in the Customer Portal that has the toolbox.
broken_arrow
el 17 de Oct. de 2021
Thanks for providing the new link. Still, the time stamp is from 2017 and according to the text, the toolbox works for Matlab releases from 2014b through 2016a. It would be great to get an update on the state of things (@Sarah Palfreyman, @MathWorks Support Team).
SorMun
el 16 de Nov. de 2023
The toolbox is now availabe for download from Mathworks File Exchange at
I updated it and It support all Matlab versions from 2014b to 2023b and ANSYS versions from R15 to R23.2
Thank you
Sorin
Akshay Kumar
el 13 de Jun. de 2018
Editada: Akshay Kumar
el 14 de Jul. de 2018
0 votos
Categorías
Más información sobre Downloads en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!