function T = Combine_noTree(T1,T2,gate)
[n1 dump] = size(T1);
[n2 dump] = size(T2);
newnames1 = [];
newnames2 = [];
T1.nBAS = zeros(n1,1);
T2.nBAS = zeros(n2,1);
counter = 1;
for i = 1:n1
    if T1{i,"Type"} == "BAS"
        T1{i,"nBAS"} = counter;
        counter = counter+1;
    end
    newnames1 = [newnames1;"t1_"+string(T1.Properties.RowNames{i})];
    T1{i,"Children"}{1} = "t1_"+T1{i,"Children"}{1};
end
nBAS1 = counter-1;
T1.Properties.RowNames= newnames1;
counter = 1;
for i = 1:n2
    if T2{i,"Type"} == "BAS"
        T2{i,"nBAS"} = counter;
        counter = counter+1;
    end
    newnames2 = [newnames2;"t2_"+string(T2.Properties.RowNames{i})];
    T2{i,"Children"}{1} = "t2_"+T2{i,"Children"}{1};
end
T2.Properties.RowNames= newnames2;
nBAS2 = counter-1;
r1 = randi([1 nBAS1]);
r2 = randi([1 nBAS2]);
for i = 1:n1
    if T1{i,"nBAS"} == r1
        mBAS1 = string(T1.Properties.RowNames{i});
    end
end
for i = 1:n2
    if T2{i,"nBAS"} == r2
        mBAS2 = string(T2.Properties.RowNames{i});
    end
end
for i = 1:n2
    for j = 1:length(T2{i,"Children"}{1})
        if T2{i,"Children"}{1}(j) == mBAS2
            T2{i,"Children"}{1}(j) = mBAS1;
        end
    end
end
T2(mBAS2,:) = [];
T1.nBAS = [];
T2.nBAS = [];
newroot = {gate,{[string(T1.Properties.RowNames{n1}) string(T2.Properties.RowNames{n2-1})]},0};
T = [T1;T2;newroot];
T.Properties.RowNames{n1+n2} = 'Root';
end