function System = import_BEM_system(filename)

fid = fopen(filename);
if (fid == -1)
    error('Error opening matrix file!');
end;

%kiolvasni a sor- es oszlopszamot
mat_size = fread(fid, 2, 'int32');
N = mat_size(1);
M = mat_size(2);

%letrehozni a matrixokat
System.A = zeros(N,M);
System.B = zeros(N,M);

%nhany segedvektor a szeparalashoz
ind1 = 4*(1:M)-3;
ind2 = 4*(1:M)-2;
ind3 = 4*(1:M)-1;
ind4 = 4*(1:M)-0;

%sorfolytonos kiolvasas
WB = waitbar(0,'Importing AcouBEM system');
for n = 1 : N
    vec = fread(fid, 4*M, 'float64');
    System.A(n,:) = (vec(ind1) + i*vec(ind2)).';
    System.B(n,:) = (vec(ind3) + i*vec(ind4)).';
    waitbar(n/N,WB);
end
close(WB);