MATLAB: Combine two cell arrays containing string values into one.

cell arrayscombinestrings

Hi.
I have two cell arrays that look something like this:
A = {'1.'; '2.'; '3.'; '4.', '5.'};
B = {'A'; 'B'; 'C'; 'D'; 'E'};
Both are of the same length.
I want to combine them into a third cell array that looks like this:
C = {'1. A'; '2. B'; '3. C'; '4. D'; '5. E'};
How can I do this?
Thanks!

Best Answer

A = {'1.'; '2.'; '3.'; '4.'; '5.'};
B = {'A'; 'B'; 'C'; 'D'; 'E'};
C=cellfun(@(x,y) [x ' ' y],A,B,'un',0)