Skip to content

Commit

Permalink
Add print_concepts function
Browse files Browse the repository at this point in the history
  • Loading branch information
marioarbras committed May 26, 2020
1 parent 16e37ce commit 75c684d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions adt.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

%% Concept
data.concept = ahp(data.concept);
print_concepts(data.concept)

%% Take-off mass estimation
[data.mission, data.aircraft] = mtow(data.mission, data.aircraft, constants);
Expand Down
22 changes: 22 additions & 0 deletions print_concepts.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
% Aircraft design tool
%
% Mario Bras ([email protected]) and Ricardo Marques ([email protected]) 2019
%
% This file is subject to the license terms in the LICENSE file included in this distribution

function print_concepts(concept)
weights = zeros(1, length(concept.designs));
names = cell(1, length(concept.designs));

for i = 1 : length(concept.designs)
weights(i) = concept.designs{i}.weight;
names{i} = concept.designs{i}.name;
end

[weights,order] = sort(weights,'descend');

fprintf('<strong>Concepts</strong>\n');
fprintf(" - <strong>%s: %f</strong> 🥇\n", names{order(1)}, weights(1));
for i = 2 : length(concept.designs)
fprintf(" - %s: %f\n", names{order(i)}, weights(i));
end

0 comments on commit 75c684d

Please sign in to comment.