b and d are two arrays that are given. I create aa and cc out of b andd`. This is what I do:
aa = {};
cc = {};
Do[If[j == 1,
AppendTo[aa, b[[i, j]]],
If[j == 2, AppendTo[cc, d[[i, j]]]]],
{i, 1, 9, 1}, {j, 1, 2, 1}]
With this code I create the two vectors of length 9. The problem is that each time I execute the Do again, the length of my vectors increase by 9. How can keep their length fixed at 9?
aa = b[[1;;9, 1]]and similar ? – b.gatessucks Mar 7 at 9:54aa={};cc={};(that is, resetaaandccto empty set) before you executeDo[...]. But... why don't you useaa = b[[;;9, 1]];cc = d[[;;9, 2]];instead? – kguler Mar 7 at 10:00