MATLAB: Use of horzcat

concatenation

What is the use of horzcat? Is there an advantage of using horzcat over manually concatenating arrays horizontally? for example:
A = {'a','b','c'};
B = {'d','e'};
C = horzcat(A,B);
This is the same as:
A = {'a','b','c'};
B = {'d','e'};
C = [A,B];
So, is there an advatage of using horzcat?

Best Answer

When you type [A, B] in the code, horzcat is called internally, as it is when it is called explicitely also. [.,.] is a synonym only.
cat(2, A, B) replies the same result, but as far as I remember it has a tiny difference in the runtime.