MATLAB: Incremental indexing to create an array

for loopindexing

Hi,
I have a 1097×1097 array (called list_of_distances) and would like to index into that array repeatedly; I only need certain values from the array. By doing this repeated indexing, I'd like to create new array that is 1×1097 of values. I included a screen shot of the values I'm looking to get into a new array.
Any help would be appreciated
Michael
Michael
R = 2
S = 1
for i = length(list_of_distances)
final_list(i) = list_of_distances(R,S)
R = R+1
S = S+1
end

Best Answer

using diag(list_of_distances, -1) to get the diagonal you want.