1
votes

I have some code written in Matlab, I have A 5x5 matrix, where block (1,1), (2,2), (3,3), (4,4), and (5,5) = 1 . I set those blocks to 1 only as a border to separate upper right region and bottom left region of the matrix. My question is how to pick values only from the upper right region, where the value of A > threshold, without the border values of 1?

This is the example, where Threshold 0.43, and the yellow blocks is the border value 1, the green blocks are the result that I want.

I already implemented, but still can't pick the right block that I want. Please Help Thankyou.

nb :

Threshold = 0.43

A = [1 0.03 0.45 0.25 0.046; 0.03 1 0.32 0.11 0.36; 0.45 0.32 1 0.68 0.42; 0.25 0.11 0.68 1 0.55; 0.046 0.36 0.42 0.55 1]
1

1 Answers

0
votes
 A(triu(A,1)>Threshold)

compare the uppertriangular part of the matrix w/ the threshold to get indices, then use indices to pull from original matrix A