function [Length] = CalculateLength(mwell_i,mwell_p,H,I,dx,dy)

Ni = length(mwell_i);
Np = length(mwell_p);

count = 1;
for i = 1:Ni
    ii = ceil(mwell_i(i)/H);
    hi = mwell_i(i) - ((ii-1)*H);
    ii = (ii*dy)-(dy/2);
    hi = (hi*dx)-(dx/2);
    for p = 1:Np
        ip = ceil(mwell_p(p)/H);
        hp = mwell_p(p) - ((ip-1)*H);
        ip = (ip*dy)-(dy/2);
        hp = (hp*dx)-(dx/2);
        Length(count,1) = sqrt(((ii-ip)^2) + ((hi-hp)^2));
        count = count + 1;
    end
end
    