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
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
Merve 2014년 9월 23일
I added "C:\Program Files\ANSYS Inc\v145\ansys\bin\winx64\ANSYS145.exe" to the Environmental Path and this did not work. I solve problem by changing the command as
dos('"C:\Program Files\ANSYS Inc\v145\ansys\bin\winx64\ANSYS145.exe" -b -i model2.txt -o output2.txt');
Geoff Hayes
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
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
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
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
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
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
Prakul Mittal 2017년 2월 27일
Hi Sorin & Walter,
Thanks for the input.
sina salahshour
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,
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
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
Walter Roberson 2023년 6월 13일
nice answer, would like to more about that

댓글을 달려면 로그인하십시오.

 채택된 답변

Sarah Palfreyman
Sarah Palfreyman 2017년 1월 10일

0 개 추천

See ANSYS for the MATLAB AAS Toolbox interface.

댓글 수: 6

Oscar Espinosa
Oscar Espinosa 2020년 5월 25일
That doesn't solve the issue in the case of having a ANSYS students license.
Zhou Xuyang
Zhou Xuyang 2023년 2월 16일
It seems to have nothing there. Can you please tell me the newest website?
Walter Roberson
Walter Roberson 2023년 2월 16일
As discussed below, the company moved their software to a website that the public and students do not have access to.
The software when it was available was only for a range of MATLAB releases roughly 8 years ago.
Walter Roberson
Walter Roberson 2023년 2월 16일
https://forum.ansys.com/forums/topic/download-matlab-toolbox-ansysaas/ suggests that students try to find someone with a paid TECS support account, which can access the customer portal and so download the software (or at least could in the past; I do not know if it is still there.)
Arman Burkitbayev
Arman Burkitbayev 2023년 6월 2일
is there any news about live data exchange between ansys and matlab?
SorMun
SorMun 2023년 11월 16일
The toolbox is now availabe for download from Mathworks File Exchange at
Sorin

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

broken_arrow
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
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
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
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
Akshay Kumar 2018년 6월 13일
편집: Akshay Kumar 2018년 7월 14일

0 개 추천

Check this out, might be helpful. using MATLAB to run (ANSYS) APDL macro code

카테고리

도움말 센터File Exchange에서 Downloads에 대해 자세히 알아보기

제품

질문:

2014년 9월 20일

댓글:

2023년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by