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

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.

 채택된 답변

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})

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by