What's wrong with -> ??? Error using ==> vertcat

1 次查看(过去 30 天)
tedy
tedy 2013-4-12
Hello,
i wanna ask, what's wrong with my code bellow?
data=[
1 1:1 2:2 3:2 4:2 5:2 6:2 7:2 8:2 9:2 10:2 11:2 12:2 13:2 14:2 15:2 16:3;
1 1:1 2:2 3:2 4:2 5:2 6:2 7:2 8:2 9:2 10:2 11:2 12:2 13:2 14:2 15:3 16:3;
2 1:1 2:1 3:1 4:1 5:1 6:1 7:1 8:1 9:1 10:1 11:1 12:1 13:1 14:3 15:3 16:3;
3 1:1 2:1 3:1 4:1 5:1 6:1 7:1 8:1 9:1 10:2 11:2 12:1 13:1 14:3 15:3 16:1];
it's so simple, but it result ??? Error using ==> vertcat CAT arguments dimensions are not consistent. is there something wrong? please help me. Thanks in advance
  1 个评论
Iman Ansari
Iman Ansari 2013-4-12
编辑:Iman Ansari 2013-4-12
the result is:
1 1 2
1 1 2
2 1
3 1
each row has different number of columns. What is 3:2 mean?

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2013-4-12
first line: 1 is [1], 1:1 is [1], 2:2 is [2], 3:2 on to 16:3 are all [] (empty), so the first line is [1 1 2]
third line: 2 is [2], 1:1 is [1], 2:1 is empty, 3:1 through 16:3 are all [], so the third line is [2 1]. That is a different length than the first line.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by