How to run ansys workbench through system() syntax?

조회 수: 1 (최근 30일)
amir hossein dodangeh
amir hossein dodangeh 2021년 8월 17일
Hi everyone, I have a code that runs the ansys workbench and then a journal file to do my study of a heat exchanger optimization.
As you can see, it starts ansys workbench at every loop and then does the calculations, which wastes a lot of time.
I would like to know if there is a way to start the software before the loop and then run the journal file every time which can save me a lot more time in my optimization process. the problem is at the third segment of the code below.
I really appreciate your time and help in advance.
Here is the code.
clc; clear;
London_CF = zeros(1,2);
for i=1:2
%% Changing the input parameters
% inputs of y = Amplitude*sin(2*pi*x/Length)
Length = [8 8];
Angle = [20 30];
Amplitude = [1 1];
% creating new journal file
fid = fopen('BaseJournal.wbjn','r');
f = fread(fid,'*char')';
fclose(fid);
f = strrep(f,'Length' , num2str(Length(i)));
f = strrep(f,'Angle' , num2str(Angle(i)));
f = strrep(f,'Amplitude' , num2str(Amplitude(i)));
fid = fopen('finalJournal.wbjn','w');
fprintf(fid,'%s',f);
fclose(fid);
%% Calculations in ansys with input parameters
system('C:\"Program Files"\"ANSYS Inc"\v212\Framework\bin\Win64\RunWB2.exe -X -R finalJournal.wbjn');
%% saving the output parameter
London_CF(i) = xlsread('export data.csv','export data','G8');
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by