From: roya olyazadeh on 20 May 2010 14:31 I have lower triangle data for my matrix : V 1 .000000000000000E+00 V 2 .000000000000000E+00 V 3 .226602567955182E-04 V 4 .000000000000000E+00 V 5 .217013459933256E-04 V 6 .214709892952333E-04 V 7 .000000000000000E+00 V 8 .109994820796852E-04 V 9 .106655669607930E-04 V 10 .591407360765137E-05 V 11 .000000000000000E+00 V 12 .107742426056467E-04 V 13 .104264693273421E-04 V 14 .532949866175648E-05 V 15 .547875949738045E-05 I want to rearrange them again into matrix format like this : Lower triangle : 0 0 .226602567955182E-04 0 .217013459933256E-04 .214709892952333E-04 0 .109994820796852E-04 .106655669607930E-04 .591407360765137E-05 0 .107742426056467E-04 104264693273421E-04 .532949866175648E-05 .54E-05 Does any one know what is the solution ?
From: Matt Fig on 20 May 2010 15:34 For example: A = randperm(15) B = tril(ones(5)); B(logical(B)) = A
From: Roger Stafford on 20 May 2010 17:37 "Matt Fig" <spamanon(a)yahoo.com> wrote in message <ht42rc$c4c$1(a)fred.mathworks.com>... > For example: > > > A = randperm(15) > B = tril(ones(5)); > B(logical(B)) = A - - - - - - - - I have modified yours a bit, Matt. I think the size and order were wrong for what was apparently requested. A = rand(15,1); B = triu(ones(6)); B(logical(B)) = A; B = B.'; Roger Stafford
From: Matt Fig on 20 May 2010 18:17 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message - - - - > I have modified yours a bit, Matt. I think the size and order were wrong for what was apparently requested. > > A = rand(15,1); > B = triu(ones(6)); > B(logical(B)) = A; > B = B.'; > > Roger Stafford Oh, ok. I just meant to give a general example of dealing with triangular matrix indexing, and not address the OP's particulars. Thanks though!
|
Pages: 1 Prev: Labeling ROIs on image Next: how to get special details from a picture |