```Date: Mar 28, 2013 4:05 AM
Author: Bob Hanlon
Subject: Re: Creating matrix from another matrix using column position

To avoid naming conflicts with built-in symbol names, you should notstart symbol names with capital letters. For example, C is a built-insymbol.??CC[i] is the default form for the i\[Null]\[Null]^th parameter orconstant generated in representing the results of various symboliccomputations.  >>Attributes[C]={NHoldAll,Protected}Since you did not provide matrix a in a usable form (e.g., .cvs), itmust be regenerated:a = ({Range[#, # + 5], Range[# + 9, # + 11],       Range[# + 6, # + 8], Range[# + 30, # + 35],       Range[# + 39, # + 41], Range[# + 36, # + 38]} //      Flatten) & /@ {1, 7, 13, 19, 31, 37, 43, 49,    61, 67, 73, 79, 91, 97, 103, 109};The notional b array isbArray = With[{m = Max[Dimensions[a]]},   Array[b, {m, m}]];If I understand your algorithm, then to generate the c arrayf[row_, col_] := Module[{   rp = (Last /@ Position[a, row] // Sort),   cp = (Last /@ Position[a, col] // Sort)},  If[Length[rp] == Length[cp],   Total[bArray[[##]] & @@@ Thread[{rp, cp}]], 0]]c = With[{m = Max[a]},   Table[f[row, col], {row, m}, {col, m}]];Looking at your test cases:c[[49, 50]]b[1, 2] + b[10, 11] + b[13, 14] + b[22, 23]c[[1, 100]]0Bob HanlonOn Sun, Mar 24, 2013 at 11:23 PM, anton siswo <masgandhul@gmail.com> wrote:> Hello everyone here.....>> I have problem here, I have a matrix 16x24, lets call it matrix A. There is Matrix B 24x24 which depend on the reading row and column with values from Matrix A.>> Here are link for matrix A: https://docs.google.com/file/d/0B-dcMNCq0QF8OTdPMS1WRVNxb1k/edit?usp=sharing>> After that, I want to create matrix C, consist of matrix 150x150.>> The rule are below here:>>  1. Matrix C formed from matrix A.>  2. Each row and column from matrix C are read the values from matrix A for each row, not the entire matrix. If there is no values from matrix A (based on the tables) from each row from matrix A, such as A[1,100] then the value in C[1,100] is 0. For examples, row and column in matrix C [49,50] are formed from matrix A, for 49 in [8,1];[7,10];[4,13];[3,22] and for 50 in [8,2];[7,11];[4,14];[3,23]. I'm already using Position command in mathematica.>  3. After that, get the column value only from matrix C for 49 and 50. It should be like this, for 49-> 1,10,13,22 and for 50 -> 2,11,14,23.>  4. When we already got the column value for 49 and 50, we are forming the value from point 3 into [1,2];[10,11];[13,14];[22,23]. this 4 new elements are taking the value from matrix B in B[1,2];B[10,11];B[13,14];B[22,23].>  5. After finished taking the value in matrix B, we sum it. So it should be sum of values from B[1,2] + B[10,11] + B[13,14] + B[22,23].>  6. When finished, we take the result in matrix C. So, it should be C[49,50] = value from B[1,2] + B[10,11] + B[13,14] + B[22,23].>  7. It goes along the way for matrix C starting from [1,1] until [150,150] using the rules before.>> So, my question is how to implement it in mathematica? I'va been stuck for a month, because of this algorithm.>> Thank you very much and I do sorry for my bad grammar.>
```