function [] = write_output(check_breguet,matrix,matrix_converted,k,input_iterati,TsuW,Weng)


index=["Lb" "Dbe" "Fr" "Sref" "Wspan" "AR" "W/S" "Swfh" "Swfv" "Tail Area"... 
"Sbtot" "Vtot" "Vpay" "Wpay" "Wtnk" "Wttj" "Wttr" "Wtrj" "Wtsj" "Wpros"...
"Wb" "Ww" "W_tail" "Wtps" "Wgear" "Wthrua" "Wstr"...
"Wfuel" "Wtaves" "Whydr" "Welect" "Wequip" "Wsub" "Wgtot"];

index2=["Wgtot, kg","Wfuel, kg","Weng, kg","Wpay, kg","Sref, m^2","Vtot, m^3","Lb, m","W/S","T/W_LO"];

% incremento valori formula di Breguet per ogni iterazione

print_breguet=[["tau" "Sref" "Vtot" "E" "WH2"];check_breguet];
writematrix(print_breguet,'Output\breguet_iterati.xlsx');


% valori puri per ogni iterazione

print_iter=[index([1 2 4 5 10 11 12 20 27 28 33 34]); matrix_converted(:,[1 2 4 5 10 11 12 20 27 28 33 34])]';
writematrix(print_iter,'Output\valori_iterati.xlsx')

print_iter_completo=[index;matrix_converted]';
writematrix(print_iter_completo,'Output\valori_iterati_completo.xlsx')

% incremento valori per ogni iterazione

print_input_iter=[index([34,12,1,2]);input_iterati];
writematrix(print_input_iter,'Output\input_iterati_incremento.xlsx');

print_iter_incremento=[index;(matrix_converted(2:k,:)-matrix_converted(1:k-1,:))./matrix_converted(1:k-1,:)]';
writematrix(print_iter_incremento,'Output\valori_iterati_incremento.xlsx');

% valori finali
                                                                  
print_final=[index2;[matrix_converted(k,[34,28]),Weng*0.4536,matrix_converted(k,[14,4,12,1,7]),TsuW]]';
writematrix(print_final,'Output\results.xlsx')

print_final_extended=[[" ",index,"tau","E","WH2"];...
["imperiale",matrix(k,:),check_breguet(k,1),check_breguet(k,4),check_breguet(k,5)];...
["internazionale",matrix_converted(k,:),check_breguet(k,1),check_breguet(k,4),check_breguet(k,5)]]';
writematrix(print_final_extended,'Output\results_extended.xlsx')


end