Filename = 'Case_1.txt';
fid = fopen(Filename);
tline = fgetl(fid);
while ischar(tline)
if contains(tline,'Engine Speed :')
tmp = strtrim(regexp(tline, '\s+', 'split'));
dd = regexp(tmp,'-?[0-9]+.[0-9]+', 'match');
str_temp = strjoin( cat(2,dd{:}), ',') ;
Engine_Speed = str2num(str_temp);
end
if contains(tline,'BMEP [bar]')
tmp = strtrim(regexp(tline, '\s+', 'split'));
dd = regexp(tmp,'-?[0-9]+.[0-9]+', 'match');
str_temp = strjoin( cat(2,dd{:}), ',') ;
BMEP = str2num(str_temp);
end
if contains(tline,'BSFC [g/kWh]')
tmp = strtrim(regexp(tline, '\s+', 'split'));
dd = regexp(tmp,'-?[0-9]+.[0-9]+', 'match');
str_temp = strjoin( cat(2,dd{:}), ',') ;
BSFC = str2num(str_temp);
end
tline = fgetl(fid);
end
fclose(fid);
0 Comments
Sign in to comment.