The easiest way (without seeing your code) is to initialise a counter before the loop, increment it within the loop, and subscript the variables calculated in the loop:
k1 = 1;
a(k1) = some_expression;
b(k1) = some_other_expression + a(k1);
k1 = k1+1;
Here, â€˜aâ€™ and â€˜bâ€™ will be available as vectors at the end of the loop, and available to each other within the loop. Thatâ€™s as specific as I can get.