??? Error using ==> horzcat, CAT arguments dimensions are not consistent.
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Thomas
2012 年 3 月 30 日
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.
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!