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.

 Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by