??? Error using ==> horzcat, CAT arguments dimensions are not consistent.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have two cell arrays, both of length n. One array contains nX1 strings, while the other array is contains nx1 type double. I'm trying to create a new variable that is nx2.
The error doesn't seem to make sense to me, since the dimensions of both arrays are identical. This is probably a novice error, so I'll lay out exactly what I've done:
A = {a, b, c, d, ..., n}
B = {1,2,3,4....n}
C = [A,B]
??? Error
If I attempt this:
C = [A;B]
The new variable that is created is (n+1)x1 containing all of the cells in A plus a new cell with text (nx1 double), but lacking any of the values stored within B.
A and B are variables that have been imported using xlsread
If anyone can help me with the problem and shed some light on why exactly this is happening I would greatly appreciate it. Thank you.
0 commentaires
Réponses (1)
Thomas
le 30 Mar 2012
you should try
A = {'a', 'b', 'c', 'd'}
B={1,2,3,4}
C=[A,B];
D=[A;B];
Make sure A and B are being declared as cells.
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!