From: Pradeep Ramalingam on 25 May 2010 03:06 i'm creating a matrix 10*10 in which 50% of them needs to be filled with number 3 and remaining 50% can be filled in random from 0 to 2... please help... need some assistance...
From: Darren Rowland on 25 May 2010 03:36 A = floor(3*rand(10)); r = randperm(100); A(r(1:50)) = 3; Hth Darren
From: Roger Stafford on 25 May 2010 03:38 "Pradeep Ramalingam" <pradeep.ramalingam(a)gmail.com> wrote in message <htfsss$13i$1(a)fred.mathworks.com>... > i'm creating a matrix 10*10 in which 50% of them needs to be filled with number 3 and remaining 50% can be filled in random from 0 to 2... please help... need some assistance... - - - - - - - - - m = 3*ones(10); p = randperm(100); m(p(1:50)) = floor(3*rand(50,1)); I am assuming here you intended the replacements to be integers 0, 1, and 2. Otherwise replace the floor(3*rand(50,1)) with 2*rand(50,1). Roger Stafford
|
Pages: 1 Prev: Integration step size in ode15s Next: How to hide the application icon in the taskbar? |