You can create a vector with a fixed size before the loop starts and fill it iteratively within the loop. Here is an example code snippet:
main.m268 chars11 lines
In this example, n
specifies the number of iterations you want to perform. The loop calculates some changing value at each iteration and stores it into the myVector
array. After the loop finishes, the myVector
array will contain n
values that were generated during the iterations.
gistlibby LogSnag