Hello,
I have a matrix:
A = 3.0000 2.2200 5.0000 2.2187 7.0000 2.2171 9.0000 2.2132 11.0000 2.2168 13.0000 2.2277 15.0000 2.2283 19.0000 2.2451
I want to take first value and put in new matrix:
[ExtractedA] = A(1,:);
Then, I want it to find the next value that is >= 20; i.e. First values in ExtractedA are:
3.0000 2.22009.0000 2.2132 %this value because +5+7+9 = 21 (which is >=20)
Then, I need it to start again looking for the next +20 after the 9:
13.0000 2.2277 %this would be next, since 11+13 >= 20.
Any help on the best function to do this? I know this is likely trivial, but my searching is not yielding much!
Thanks!
Best Answer