I think you mean
xp1 = rand(2,3);
xp2 = rand(4,5);
xp3 = rand(1,4);
xp4 = rand(12,18);
szx1 = max([size(xp1,1),size(xp2,1),size(xp3,1),size(xp4,1)]);
xp1 = [xp1;nan(szx1-size(xp1,1),size(xp1,2))];
xp2 = [xp2;nan(szx1-size(xp2,1),size(xp2,2))];
xp3 = [xp3;nan(szx1-size(xp3,1),size(xp3,2))];
xp4 = [xp4;nan(szx1-size(xp4,1),size(xp4,2))];
xp = [xp1,xp2,xp3,xp4]