MATLAB: Does the CAT function return error when attempting to concatenate a cell array with an empty vector in MATLAB 7.0 (R14)

arraycatcellconcatenateMATLAB

When, I try to concatenate a cell array with an empty array in MATLAB 7.0 (R14):
a = {'123', 'qwe', 'asd'};
x = [];
cat(1, a, x)
I receive the following error:
??? Error using ==> cat
The following error occurred converting from double to cell:
Error using ==> cell
Size vector must be a row vector with integer elements.

Best Answer

This bug has been fixed in MATLAB 7.0.4 (R14SP2). If you are using a previous version, read the following:
There is a bug in MATLAB 7.0 (R14) that affects the way MATLAB handles empty arrays. To work around this issue, convert "x" to a cell array.
a = {'123', 'qwe', 'asd'};
x = [];
cat(2, a, {x})