Error using horzcat dimensions

This is my code
pra= kependudukan((kependudukan(:,6)==1),:);
ks1=kependudukan((kependudukan(:,6)==2),:);
ks2=kependudukan((kependudukan(:,6)==3),:);
Characteristics = {'usia','pendidikan','pekerjaan','Tanggungan','status','luas'};
pairs = [1 2; 1 3; 1 4; 2 3; 2 4; 3 4; 1 5; 1 6; 2 5; 2 6; 3 5; 3 6; 4 5; 4 6;5 6; 6 4];
h = figure;
for j = 1:16,
x = pairs(j, 1);
y = pairs(j, 2);
subplot(4,4,j);
plot([pra(:,x) ks1(:,x) ks2(:,x)],...
[pra(:,y) ks1(:,y) ks2(:,y)], '.');
xlabel(Characteristics{x},'FontSize',10);
ylabel(Characteristics{y},'FontSize',10);
the error: Error using horzcat Dimensions of matrices being concatenated are not consistent.

回答(1 个)

You are try to concatenate (i.e. combine) some arrays that don't have matching sizes. The code below should work, but might not be what you mean.
plot([pra(:,x);ks1(:,x);ks2(:,x)],...
[pra(:,y);ks1(:,y);ks2(:,y)], '.');

类别

帮助中心File Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息

提问:

2018-5-27

回答:

Rik
2018-5-27

Community Treasure Hunt

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

Start Hunting!

Translated by