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.

Antworten (1)

Rik
Rik am 27 Mai 2018

0 Stimmen

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)], '.');

Kategorien

Mehr zu Fuzzy Logic Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 27 Mai 2018

Beantwortet:

Rik
am 27 Mai 2018

Community Treasure Hunt

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

Start Hunting!

Translated by