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.

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

Categories

Find more on Fuzzy Logic Toolbox in Help Center and File Exchange

Asked:

on 27 May 2018

Answered:

Rik
on 27 May 2018

Community Treasure Hunt

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

Start Hunting!