Error using horzcat Dimensions of matrices being concatenated are not consistent.

2 ビュー (過去 30 日間)
hanif hamden
hanif hamden 2019 年 4 月 26 日
コメント済み: hanif hamden 2019 年 4 月 29 日
I can't arrange my data as the error shows like this:
Error using horzcat.
Dimensions of matrices being concatenated are not consistent.
Error in DemoCircle (line 29)
TotalC = [y0, x0, listC]
I need help. This is my coding:
count(i) = sum(((x-x0(i)).^2+(y-y0(i)).^2<=R^2));
listC = count.'
TotalC = [y0, x0, listC]
y0 & x0 both value are 7125x1 double. same goes to listC. The problem is that when I run the coding with TotalC = [y0, x0, listC] ..The error shows as above.
Hope someone can help this
  2 件のコメント
madhan ravi
madhan ravi 2019 年 4 月 26 日
size(x0)
size(y0)
size(listC)
hanif hamden
hanif hamden 2019 年 4 月 26 日
all have the same size
7125 x 1

サインインしてコメントする。

採用された回答

Jan
Jan 2019 年 4 月 26 日
Use the debugger to solve such problems. Type in the command window:
dbstop if error
Start the code again, and when the problem let Matlab stop, check the sizes of the used arrays:
size(x0)
size(y0)
size(listC)
I guess you want:
listC = count;
without transposing.
  4 件のコメント
Jan
Jan 2019 年 4 月 28 日
@hanif hamden: If all 3 variables have the size [7125 x 1], the vertical concatenation would work successfully. Please check this again.
hanif hamden
hanif hamden 2019 年 4 月 29 日
yeah there some error from the data. I just fixed it then it works well. Thank you so much :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by