
clc;
clear all;

A = importdata('list_industries.csv');
for i=1:length(A.colheaders)
    eval([A.colheaders{i},'=A.data(:,i);'])
end
clear A 

% exposure = ratio_im_china_ii;
% exposure = ratio_im_china_gen_eu0_ii;
% exposure = ratio_im_china_gen_eu0_cost;
exposure  = ratio_im_china_gen_eu1_cost;
exposure2 = ratio_im_china_gen_eu1_cdo1;


naics = cell(length(naics4int),1);
for i=1:length(naics4int)
    naics{i,1} = string(naics4int(i));
end
ind = find(naics4int==3311);
naics{ind} = "3311,2";
ind = find(naics4int==3333);
naics{ind} = "3333,9";
ind = find(naics4int==3372);
naics{ind} = "3372,9";


naics_desc = {
"Logging"; "Cement and concrete";
"Oil and gas extraction" ; "Lime and gypsum  " ;
"Coal mining" ; "Other nonmetallic minerals  " ;
"Metal ore mining";	 "Iron and Steel  " ;
"Nonmetallic mineral mining "; "Aluminum" ;
"Support activities for mining"; "Nonferrous metals  " ;
"Electric power generation";	 "Foundries " ;
"Natural gas distribution"; "Forging and stamping " ;
"Animal food"; "Cutlery and handtool " ;
"Grain and oilseed ";	 "Architectural metals " ;
"Sugar and confectionery";	 "Boiler, Shipping Container  " ;
"Fruit, vegetable preserving ";	 "Hardware " ;
"Dairy product";	 "Spring and wire product " ;
"Animal processing";	 "Machine shops " ;
"Seafood preparation ";	 "Coating, heat treating " ;
"Bakeries and tortilla";	 "Other fabricated metals" ;
"Other food";	 "Agriculture, construction " ;
"Beverage";	 "Industrial machinery " ;
"Tobacco";	 "Commercial, Service Industry  " ;
"Fiber, yarn, and thread ";	 "Ventilation, heating" ;
"Fabric ";	 "Metalworking machinery " ;
"Textile finishing ";	 "Engine, power transmission  " ;
"Textile furnishings";	 "Computer equipment " ;
"Other textiles ";	 "Communications equipment " ;
"Apparel";	 "Audio and video equipment " ;
"Leather and allied product";	 "Semiconductor component " ;
"Sawmills, wood preservation";	 "Navigational, measuring  " ;
"Veneer, engineered wood";	 "Magnetic and Optical Media " ;
"Other wood product";	 "Electric lighting equipment " ;
"Pulp, paper, paperboard";	 "Household appliance " ;
"Converted paper product";	 "Electrical equipment " ;
"Printing";	 "Other electrical equipment  " ;
"Petroleum, coal products";	 "Motor vehicle " ;
"Basic chemical";	 "Motor vehicle body, trailer " ;
"Resin, synthetic rubber ";	 "Motor vehicle parts " ;
"Pesticide, fertilizer";	 "Aerospace products " ;
"Pharmaceutical, medicine";	 "Railroad rolling stock " ;
"Paint, coating, adhesive";	 "Ship and boat building " ;
"Soap and cleaning";	 "Other transport equipment " ;
"Other chemical product ";	 "Household furniture " ;
"Plastics product";	 "Office furniture  " ;
"Rubber product";	 "Medical equipment  " ;
"Clay product and refractory";	 "Other miscellaneous mfg " ;
"Glass and glass product";	 "Newspaper, periodical, book  " 
};
naics_desc = [naics_desc(1:2:end);  naics_desc(2:2:end)];



fileID = fopen('list_industries2.tex','w');
for i=1:44
    fprintf(fileID,'%s %s %s %s %1.2f%s %s %1.2f%s',naics{i},' \ ',naics_desc{i},' & ',exposure(i),'\%',' & ',exposure2(i),'\%')
    fprintf(fileID,'%s ',' & ')
    fprintf(fileID,'%s %s %s %s %1.2f%s %s %1.2f%s',naics{44+i},' \ ',naics_desc{44+i},' & ',exposure(44+i),'\%',' & ',exposure2(44+i),'\%')
    fprintf(fileID,'%s \n',' \\ ')
end
fclose(fileID);



