-
Notifications
You must be signed in to change notification settings - Fork 1
/
ScriptChanger.m
55 lines (41 loc) · 1.88 KB
/
ScriptChanger.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%
% _____ _____ ______
% /\ / ____| __ \| ____|
% / \ | | | |__) | |__
% / /\ \| | | _ /| __|
% / ____ \ |____| | \ \| |____
% /_/ \_\_____|_| \_\______|
% ACRE - Automated CFD Characterisation for Low Temperature Reaction Kinetics
% GNU License
% Copyright (c) [2024] [Luke Driver (University of Leeds)]
% email: scldr@leeds.ac.uk - Contact me for questions, troublshooting or if you want any functionaliy added!
% Note this code only works on a linux system and has been primarily made to be run on the HPC.
% You need to have both MATLAB, and Ansys Fluent and ICEM (2022 R1 or later)
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <https://www.gnu.org/licenses/>.
%SCRIPTCHANGER
% This script is used to modify the lines in each script file
% It opens up the script file passed into the function, reads the contents
% of the file and changes the line specified into the function.
function ScriptChanger(ScriptName,ScriptLine, LineChange)
file_contents = fileread(ScriptName);
lines = splitlines(file_contents);
Line = ScriptLine;
Change = LineChange
lines{Line} = Change;
for i = 1:numel(lines)
lines{i} = char(lines{i});
end
new_file_contents = strjoin(lines, '\n');
fid = fopen(ScriptName, 'w');
fwrite(fid, new_file_contents);
fclose(fid);
end