Hi, I have a matrix AQ_z_matrix where the elements are aircraft altitudes (each column is an aircraft and rows are times at which the altitudes were taken) and I need to compare aircraft's altitudes with each other and find out if the difference (range) is equal or higher than 10000. Then I want to define another matrix called msg_matrix. If the range condition in AQ_z_matrix is met a value 1 is put in the msg_matrix to same row and column as the row and column of the aircraft which are being compared.
To give an example: If AQ_z_matrix=[10000 11000 20000] then msg_matrix would be [1 0 1] as the altitude difference condition is met only between 1st and 3rd aircraft. If AQ_z_matrix was [10000 11000 21000 ] then msg_matrix would be [1 1 2]. Here the condition is met between 1st and 3rd and between 2nd and 3rd aircraft. That means that 3rd aircraft complies the condition twice (it has the altitude difference equal or higher than 10000 in relation with 2 aircraft) and thus there's 2 (1+1) in msg_matrix, for 2nd and 1st aircraft there's only 1 as they only meet the condition in relation with aircraft 1 not between each other.
I have been trying to solve it with this piece of code but it obviously does not compare all values in a row and I don't know how to make it work.