forked from jemoster/aerospace-design-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 1
/
parseProp.m
34 lines (27 loc) · 875 Bytes
/
parseProp.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
function [ prop ] = parseProp( filename )
%Copyright 2011 Joseph Moster
%Reads a file reference by filename and extracts propeller data from it
% The file should be formatted in the same fasion as the propeller data
% in the UIUC propeller data base
%Open the file
fid = fopen(filename);
try
%Discard the column headers
prop.name = textscan(filename, '%s %s %s %s','delimiter','_');
%Discard the column headers
textscan(fid, '%s %s %s %s',1);
%Scan the remainder of the file's four data fields
D = textscan(fid, '%f %f %f %f');
%Split the data into individual matrices
prop.J = cell2mat(D(1));
prop.CT = cell2mat(D(2));
prop.CP = cell2mat(D(3));
prop.eta = cell2mat(D(4));
catch e
%If anything fails make sure the file is closed
fclose(fid);
throw(e);
end
%Close the file
fclose(fid);
end