-
Notifications
You must be signed in to change notification settings - Fork 1
/
trConv.m
46 lines (43 loc) · 1.78 KB
/
trConv.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
% ________ ___ __ _____ ______
% |\ ____\|\ \|\ \ |\ _ \ _ \
% \ \ \___|\ \ \/ /|_ \ \ \\\__\ \ \
% \ \ \ \ \ ___ \ \ \ \\|__| \ \
% \ \ \____\ \ \\ \ \ __\ \ \ \ \ \
% \ \_______\ \__\\ \__\\__\ \__\ \ \__\
% \|_______|\|__| \|__\|__|\|__| \|__|
%
% Author: Andrea Somma;
% Politecnico of Milan
%
% trConv converts a Chemkin transport sheet into a matlab matrix
%
% - trConv(filePath): where "filePath" is the path to the chemkin
% transport sheet.
function trConv(trans_data_name)
% readmode thermodinamics file
ReadFileID = fopen(strcat(trans_data_name), 'rt');
% creating directory if not ex
if ~exist("transport_models/")
mkdir("transport_models/")
end
% read first line
textLine = fgetl(ReadFileID);
% start counters
lineCounter = 1;
specieCounter = 1;
% looping on lines
while ischar(textLine)
splitted = split(textLine);
if length(textLine) >15
if textLine(1) ~= "!"
dataTr(specieCounter,1:7) = splitted(1:7);
specieCounter = specieCounter + 1;
end
end
% Read the next line.
textLine = fgetl(ReadFileID);
lineCounter = lineCounter + 1;
end
fclose(ReadFileID);
save("./transport_models/conv.mat","dataTr")
end