For example, I have 5 time steps and a duration value:
TimeSteps = [4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 16];
Duration = [5, 3, 3];
I want to automatically generate the means between the time steps for every duration. In this case, the result would look like this:
Result = [mean([4, 5, 6, 7, 8]), mean([10, 11, 12]), mean([14, 15, 16])];
This will lead to:
Result = [6, 11, 15];
I have a 474x1 duration vector, so I need to automatize this. If anyone can help, it would be great. Thank you.