EDIT:
For a row vector cell, as in your case, this will result in pad vectors with zeros to form a matrix
out=cell2mat(cellfun(@(x)cat(2,x,zeros(1,maxLength-length(x))),C,'UniformOutput',false))
out =
1 2 3 0 0
1 2 3 4 5
1 2 3 4 0
A similar question was asked earlier today, and although the question was formulated somewhat differently, my answer basically does what you want.
, :
out=cell2mat(cellfun(@(x)cat(1,x,zeros(maxLength-length(x),1)),C,'UniformOutput',false));
maxLength . , .
maxLength ,
maxLength=max(cellfun(@(x)numel(x),C));