function [In_dtb,In_ftb,Lab_dtb,Cap_dtb,Lab_ftb,Cap_ftb] = merge_sector(export,import,DTB,FTB)
% 单个年份分析 DTB 1*17
% 将贸易区分为国内贸易和国际贸易
[export_d,export_f]=classfy(export); % 省际调出900*17和出口30*17
[import_d,import_f]=classfy(import); % 省际调入900*17和进口30*17

SJTRADE = export_d+import_d; % 900*17
for i=1:1:30
    SJTRADE(31*i-30,:)=0;  % 剔除各省内部贸易
end

GTTRADE = export_f+import_f; % 国际贸易
DTrade_sector = sum(SJTRADE); %1*17
FTrade_sector = sum(GTTRADE); % 1*17

% 劳动和资本部门国内贸易壁垒
[lab_dtrade,cap_dtrade]=Sec_Di(DTrade_sector);
[lab_dtb,cap_dtb]=Sec_Di(DTB);
weight_dlar = lab_dtrade./sum(lab_dtrade);  % 沿海各省份国内贸易权重
weight_dcap = cap_dtrade./sum(cap_dtrade);  % 内陆各省份国内贸易权重

Lab_dtb_0 = lab_dtb.*weight_dlar;
Lab_dtb = sum(Lab_dtb_0);

Cap_dtb_0 = cap_dtb.*weight_dcap;
Cap_dtb = sum(Cap_dtb_0);

% 劳动和资本部门国际贸易壁垒
[lab_ftrade,cap_ftrade]=Sec_Di(FTrade_sector);
[lab_ftb,cap_ftb]=Sec_Di(FTB);
weight_flar = lab_ftrade./sum(lab_ftrade);  % 沿海各省份国内贸易权重
weight_fcap = cap_ftrade./sum(cap_ftrade);  % 内陆各省份国内贸易权重

Lab_ftb_0 = lab_ftb.*weight_flar;
Lab_ftb = sum(Lab_ftb_0);

Cap_ftb_0 = cap_ftb.*weight_fcap;
Cap_ftb = sum(Cap_ftb_0);

% 工业国内贸易壁垒和国际贸易壁垒
Indu_dtrade = [lab_dtrade;cap_dtrade];
weight_dIndu = Indu_dtrade./sum(Indu_dtrade);
Indu_dtb = [lab_dtb;cap_dtb];
In_dtb_0 = Indu_dtb.*weight_dIndu;
In_dtb = sum(In_dtb_0);

Indu_ftrade = [lab_ftrade;cap_ftrade];
weight_fIndu = Indu_ftrade./sum(Indu_ftrade);
Indu_ftb = [lab_ftb;cap_ftb];
In_ftb_0 = Indu_ftb.*weight_fIndu;
In_ftb = sum(In_ftb_0);
end