If this dynamically changes over time I would calculate the difference in the width of the matrices like this first:
sizediff = size(A,2)-size(B,2);
And then use the horzcat command to pad the B variable, either by writing this:
B = horzcat(B,zeros(size(B,1),sizediff))
or this:
B = [B,zeros(size(B,1),sizediff)]
or potentially even this:
B = cat(2,B,zeros(size(B,1),sizediff))