Prev: rectangular matrix
Next: How can I replace the repeated or relatively close numbers in an array by their average and then remove the repeated averages from the returned array?
From: Oleg Komarov on 11 May 2010 04:22 "Artur Racu" > hy everybody, > > how can help me, i hve a retangular matrix and belove the diagonal i have zeros how can i remove them without removing zeros above the diagonal, > > thank you, > Artur I suppose you have, for example purposes: rectM = rand(3,4) rectM = 0.35 0.55 0.76 0.57 0.83 0.92 0.75 0.08 0.59 0.29 0.38 0.05 Then, creating the index for the elements under the diagonal: IDXl = logical(tril(ones(size(rectM)),-1)) IDXl = 0 0 0 0 1 0 0 0 1 1 0 0 Finally I don't know what you mean by removing elements...I interpret it as NaNning them out: rectM(IDXl) = NaN rectM = 0.35 0.55 0.76 0.57 NaN 0.92 0.75 0.08 NaN NaN 0.38 0.05 Oleg |