To keep track of values during a for loop in Matlab, you can assign them to a variable within the loop. Here is an example:
main.m274 chars14 lines
In this example, the variable values
is initialized as an array of zeros with length N
. Inside the for loop, each computed result is assigned to the corresponding index in values
. After the for loop completes, you can view the values by using the disp
function.
gistlibby LogSnag