Prev: matlab compiler cgi
Next: Abort with waitbar/workbar
From: Oleg Komarov on 11 May 2010 11:02 "Artur Racu" < > "Oleg Komarov" > > "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 > > thank you, > > i found a new solution, i made a loop for extracting the upper part of the matrix, > > thanks anyway, > > Artur Be aware that looping on big matrices may result significantly slower than using triu or tril. Oleg
|
Pages: 1 Prev: matlab compiler cgi Next: Abort with waitbar/workbar |