function [ B ] = Make_B_Matrix(x_train,dim,Spline,Combinations)
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
    Anzahl_Combinations=size(Combinations,1);
    Anzahl_splines=length(Spline);
    n_train=size(x_train,1);
    
    

    B=zeros(n_train,Anzahl_Combinations);
    
    values_all=cell(1,Anzahl_splines);  
    values=zeros(n_train,dim);

    for k=1:Anzahl_splines

        for d=1:dim

            values(:,d)=fnval(Spline{k},x_train(:,d));

        end

        values_all{k}=values;

    end
    
    val_neu=zeros(n_train,dim);
    
    for k=1:Anzahl_Combinations
        
        for d=1:dim
    
            val_neu(:,d)=values_all{Combinations(k,d)}(:,d);
    
        end
        
        B(:,k)=prod(val_neu,2);
    
    
    end

end