From: amit sharma on 5 Jun 2010 12:47 dear sir I have a matrix of real number, how to make it's diagonal element zero
From: dpb on 5 Jun 2010 12:54 amit sharma wrote: > I have a matrix of real number, how to make it's diagonal element zero one of an almost limitless number of ways... x(eye(size(x))>0)=0; --
From: Wayne King on 5 Jun 2010 13:04 amit sharma <sharma.a28(a)gmail.com> wrote in message <6a6ded57-f244-460b-95db-7867c46419db(a)n20g2000prh.googlegroups.com>... > dear sir > > I have a matrix of real number, how to make it's diagonal element zero > Hi, One of many ways: V = randn(3,2); A = abs(eye(3,2)-ones(3,2)); B = V.*A; If the matrices are square, you can simplify a bit: V = randn(3); A = abs(eye(3)-ones(3)); B = V.*A; Hope that helps, Wayne
From: amit sharma on 5 Jun 2010 13:16 On Jun 5, 8:54 pm, dpb <n...(a)non.net> wrote: > amit sharma wrote: > > I have a matrix of real number, how to make it's diagonal element zero > > one of an almost limitless number of ways... > > x(eye(size(x))>0)=0; > > -- thanks
|
Pages: 1 Prev: how can i open and close gui while code is executed Next: Help for Solving a system |