Re: Making rectangular matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg27152] Re: [mg27141] Making rectangular matrix
- From: BobHanlon at aol.com
- Date: Thu, 8 Feb 2001 04:40:41 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
rs = 2; cs = 3; rl = 5; cl = 4; small = Array[a, {rs, cs}]; large = Array[b, {rl, cl}]; {pr, pc} = {Random[Integer, {1, rl-rs+1}], Random[Integer, {1, cl-cs+1}]} {2, 1} ReplacePart[large, small, Flatten[Table[{pr+i-1, pc+j-1}, {i, rs}, {j, cs}], 1], Flatten[Table[{i, j}, {i, rs}, {j, cs}], 1]] {{b[1, 1], b[1, 2], b[1, 3], b[1, 4]}, {a[1, 1], a[1, 2], a[1, 3], b[2, 4]}, {a[2, 1], a[2, 2], a[2, 3], b[3, 4]}, {b[4, 1], b[4, 2], b[4, 3], b[4, 4]}, {b[5, 1], b[5, 2], b[5, 3], b[5, 4]}} Bob Hanlon In a message dated 2001/2/7 2:16:40 AM, jeevan4 at hotmail.com writes: >How can I make a square or rectangle matrix(2-D) that can be placed >at random locations of a bigger 2-D matrix.Thank you. >