testm = [1,2,3,4,5;2,4,5,7,10]
num_pts = 5;
testm = transpose(testm)
corr = testm(:,2)*testm(:,2)'
diag(corr)
main_diag = testm(:,2).*testm(:,2)
for i=1:3
diags1{i} = testm(i+1:num_pts ,2).*testm(1:num_pts-i-1,2);
diags2{i} = testm(i+1:num_pts ,2).*testm(1:num_pts-i-1,2);
end
failed at diags1{i} = testm(i+1:num_pts ,2).*testm(1:num_pts-i-1,2); Error using .* Matrix dimensions must agree. Error in test (line 8) diags1{i} = testm(i+1:num_pts ,2).*testm(1:num_pts-i-1,2);
Got to run.