Project

Parsing NASA Thermodynamic data file

Project-1 File parsing

clear all
close all
clc

%INPUTS

R=8.31;



%Reading the NASA thermodynamic data file

f1 = fopen(\'therm.txt\',\'r\')

Header_Thermo=fgetl(f1)

thermo=fgetl(f1)

%skiping three ! lines

for i=1:3
skip=fgetl(f1);
end



%temperatute

temp=linspace(200,3500,500);

%Reading 

for i=1:300
    
skip=fgets(f1);
Species = sscanf(skip,\'%c\')

exit=Species(1:3);
last=\'END\';
if exit==last
    break
end

%Calculating molar mass

mol_mass=0;
position=25;
for i=0:2
    
    x=(position+(5*i));
    y=str2num(Species(x+4));
    
    if strcmp(Species(x),\'C\')
        mol_mass=mol_mass+12*y;
        
    elseif strcmp(Species(x),\'O\')
         mol_mass=mol_mass+16*y;
         
    elseif strcmp(Species(x),\'H\')
         mol_mass=mol_mass+1*y;
         
    elseif strcmp(Species(x),\'A\')
         mol_mass=mol_mass+40*y;
         
    elseif strcmp(Species(x),\'N\')
         mol_mass=mol_mass+14*y;
         
    else
        break;
    end
    
end
molecular_weight=0;

molecular_weight=num2str(mol_mass);

%Creating unique folder name

q=Species(1:8);
w=molecular_weight;
e=sprintf(\'%s  %s\',q,w)

unique_folder=mkdir(e)

%Taking values from the \"Speciesblock\"

a2=fgets(f1);
data2=sscanf(a2,\'%f\');

a3=fgets(f1);
data3=sscanf(a3,\'%f\');

a4=fgets(f1);
data4=sscanf(a4,\'%f\');

ht=[data2(1) data2(2) data2(3) data2(4) data2(5) data3(1) data3(2)] %High temp data

lt=[data3(3) data3(4) data3(5) data4(1) data4(2) data4(3) data4(4)] %Low temp data

for j=1:length(temp)
    t=1000; %mid temp calculation
    if temp(j)%%%Upload the code to google drive and paste the link






https://drive.google.com/file/d/1zFJAYy4SsZ_Ue-YCfpDMJYkF3mKcDdAn/view?usp=sharing

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.