using a function in a loop and saving the output for every iteration



Hi,

I am using a function to calculate the velocities given distances and
times

- the function has this form :

function [t, hvel, whichderiv] = derivative_kp(t, h_parm, whichderiv,
s)

where t = time
h_parm = distances
whichderiv = level of derivative
hvel = velocity

Both t and h_parm are 2-d arrays (R x C) - what is a good way to use
this function in a loop in that case?

When I used a for loop for this function, all values for hvel in the
output get overwritten for every iteration ...

I want to save the value from hvel for every iteration to result in a
2-d array with the same dimensions as h_parm (R x C). Could someone
please help?

Thanks much!
.



Relevant Pages