Running Ansys from Matlab
古いコメントを表示
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 件のコメント
Geoff Hayes
2014 年 9 月 20 日
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
2014 年 9 月 23 日
Geoff Hayes
2014 年 9 月 23 日
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
2016 年 7 月 11 日
編集済み: Walter Roberson
2016 年 7 月 12 日
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
2016 年 7 月 12 日
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
2017 年 1 月 25 日
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
2017 年 2 月 26 日
編集済み: Walter Roberson
2017 年 2 月 26 日
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
2017 年 2 月 26 日
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
2017 年 2 月 27 日
Hi Sorin & Walter,
Thanks for the input.
sina salahshour
2022 年 11 月 9 日
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
2022 年 11 月 9 日
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
2022 年 11 月 10 日
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
2023 年 6 月 13 日
nice answer, would like to more about that
採用された回答
その他の回答 (2 件)
broken_arrow
2021 年 5 月 17 日
編集済み: broken_arrow
2021 年 10 月 8 日
1 投票
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 件のコメント
Walter Roberson
2021 年 10 月 10 日
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
2021 年 10 月 17 日
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
2023 年 11 月 16 日
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
2018 年 6 月 13 日
編集済み: Akshay Kumar
2018 年 7 月 14 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Downloads についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!