I am trying to find a way to include arrays of different sizes in a nested for loop in matlab. For example, given some function f...
for dt = timestep
i = i + 1;
j = 0;
for t = time(i)
j = j + 1;
result(j+1) = result(j) + f(j) * dt;
end
end
In what I am trying to do, the rows of time() and result() would have different lengths and therefore this code wouldn't work. Does anyone have suggestions on how to do this or another way to approach the problem so that I don't have to write multiple, separate for loops?