From: Pr B on
i have two upper triangular matrices X and Y (doubles) and i would like to plot the elements of X against the elements of Y. X contains "scores" and Y contains "sizes", and i would like to see if there is correlation between size and score by plotting each cell of the matrices. my code:

for i = 1:1162
for j = i:1162
plot(sizes(i,j) , scores(i,j) , 'mo')
end
end

my question is, is my code correct and is there a better way to plot what i am interested in, perhaps with a scatterplot function? i am trying to plot a lot of values (1162^2)/2, and i find that my code is taking a little while to run. any thoughts?
From: Matt Fig on
One approach:

idx = triu(true(size(scores)));
plot(sizes(idx),scores(idx),'mo')
From: Andy on
Perhaps simply:

scatter(X(:),Y(:));
From: Matt Fig on
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i3uo9v$r61$1(a)fred.mathworks.com>...
> Perhaps simply:
>
> scatter(X(:),Y(:));


% Except look:
sizes = triu(3000+round(rand(20)*30));
scores = triu(3000+round(rand(20)*30));
% OP
subplot(1,3,1)
hold on
for i = 1:20
for j = i:20
plot(sizes(i,j) , scores(i,j) , 'mo')
end
end
% Matt Fig
subplot(1,3,2)
idx = triu(true(size(scores)));
plot(sizes(idx),scores(idx),'mo')
% Andy
subplot(1,3,3)
scatter(sizes(:),scores(:))