Ansys Learning Forum › Forums › Discuss Simulation › General Mechanical › how to link between ansys workbench and matlab › Reply To: how to link between ansys workbench and matlab
July 24, 2024 at 1:48 pm
mashetty
Subscriber
I am not an expert in ansys workbench simulations, but i have done some ansys mechanical simulaiton using matlab. This is the work flow, that i have followed:
1.Generate input.dat in ANSYS Workbench. Export your input file as input.dat using ansys mechancial.
Â
2.Convert input.dat to input.txt.(Example) orÂ
Rename input.dat to input.txt.
Â
3.Prepare MATLAB Script to Run ANSYS in Batch Mode
create a beam.m file in matlab using the command line
beam.m file start
%%
%%Â Â Very very important
% %important is to use the same directory of the inpt file we are working ,
%that input file and output file, current beam.m and current matlab directory everthing should in same directory
Â
!"C:\Program Files\ANSYS Inc\v241\ansys\bin\winx64\ANSYS241.exe" -b -i beam.txt -o beamout.txt
beam.m file endsÂ
first is the path to the ANSYS executable file. It specifies the location of the ANSYS program that you want to run.Â
-b indicates the batch mode of ansys
-i indicates the input file and then write the name of the input file.
-o indicates the output file and then write the name of the output file.
Â
4. Now run the matlab file and simulation runs in batch mode and output and result files are genearted, which can again be opened in ansys mechanical for visualization.
Â
5.Modify Input Parameters:
To change the force input, material properties, or boundary conditions, edit the relevant lines in the input.txt file.
After making the necessary changes, rerun the simulation using the beam.m script in MATLAB.
Â
I hope this helps.