MATLAB: How can to convert this following cell to single matrix

How can to convert this following cell to single matrix result(4,15)?
val(:,:,2) =
[2x4 double] [2x3 double] [2x4 double] [2x3 double]
[2x3 double] [2x4 double] [2x4 double] [2x4 double]
I have problem to use cell2mat, because amount the first row and second row is different. anyone have suggestion??

Best Answer

A = cell(size(val));
q1 = [val(:),arrayfun(@(x)zeros(2,x),max(c(:)) - c(:),'un',0)];
A(:) = num2cell(q1,2);
out = cell2mat(cellfun(@(x)[x{:}],A,'un',0));