variant
o34 = zeros(size(I));
o34(3,4)=1;
o34d = bwdist(o34);
distato34 = [I(I~=1) o34d(I~=1)]
more variant
o = [3 4];
dC = arrayfun(@(x)(cumsum(ones(size(I)),x)-o(x)).^2,1:2,'un',0);
d = sqrt(dC{1} + dC{2});
l = I~=1;
out = [I(l) d(l)]
more more variant
[Hi Hj] = find(I~=1);
out = [I(I~=1) sqrt(sum(bsxfun(@minus,[Hi Hj],[3 4]).^2,2))]