Help: "Error using horzcat, CAT arguments are not consistent"

So I have two data sets, a and b.
a = [1
2]
b = [20 30]
I used transpose to make b in a column as well...
x = a;
y = b';
[x,y]
However, when I try to use [x,y] it gives me the horzcat error.
I typed whos x y just to make sure they were the same size after transposing b, and sure enough:
>>whos x y
Name Size Bytes Class Attributes
x 2x1 126 cell
y 2x1 16 double
Given that they are both 2x1, I don't understand why I'm getting this error!
Any help would be appreciated. Thank you!

回答(1 个)

Why does it say that x is cell rather than double? You must have done something else to "x".
Your difficulty has to do with the rules for concatenating cell arrays together with numeric arrays: basically if you want to concatenate together a cell array and a numeric array, the cell array must be a vector.

类别

帮助中心File Exchange 中查找有关 Logical 的更多信息

产品

提问:

2013-4-4

Community Treasure Hunt

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

Start Hunting!

Translated by