Pre-Processing using Matlab
Hai everyone,
I am new to using tough2 simulation. Do anyone has experience in using Matlab as pre-processing to run the tough2?
I tried to follow the code from the internet which is "system('path\xt2_eos1 input.dat')" in Matlab.
It was running but took a very long time.
However, when I used the command prompt for xt2_eos1 with input.dat, it was working instantly.
Thank you.
regards,
Dimas
1 reply
-
Finally, I got the code from chatgpt. In case anyone needs it as well, here I attach the code:
% Get the directory of the MATLAB file
matlabFilePath = mfilename('fullpath');
[matlabFileDir, ~, ~] = fileparts(matlabFilePath);
% Specify the input and output file names
inputFileName = 'Model.dat'; % Input file name & type
outputFileName = 'Model.out'; % The output file name
% Construct the full file paths using the MATLAB file's directory
inputFilePath = fullfile(matlabFileDir, inputFileName);
outputFilePath = fullfile(matlabFileDir, outputFileName);
% Construct the system command
systemCommand = sprintf('"%s" <"%s" >"%s"', fullfile(matlabFileDir, 'xt2_eos1'), inputFilePath, outputFilePath);
% Execute the system command
system(systemCommand);