Guys, i have two codes that fill up vectors and then afterwards another piece of code should use the numbers in vector for further processing. When I use 1st code data is processed and I get expected results, but when I am trying to use 2nd code, subsequent function returns the same number as it gets without processing. I guess that it might be related to the way I save data into vector, but I have no idea how to fix it. Any help will be greatly appreciated!
When posting code, please make sure it is a minimal but compilable snippet of code that (still) reproduces your problem. Preferably with a better description of the problem than "some other code doesn't work when I use this."
Here is the code that i use to process the dara from peak_pos vector:
int UnknownGe::set_up_lim(int k)
{
int j = peak_pos[k - 1];
while(Deriv[j] > 0)
{
j--;
if(Deriv[j] == 0 || new_arr[j][0] < 2)
break;
}
if(new_arr[j][0] < 2 && Deriv[j] > 0)
return (j + 1);
if(k == 1)
{
if(new_arr[j][0] - new_arr[0][0] < 10)
return j;
else
return (j - 2);
}
else
if(peak_posD[k - 1] - peak_posD[k - 2] < 10)
return j;
else
return (j - 2);
}
and this function is supposed to find a point, in Deriv[j] array, which contains 0, and when it gets value from the 2nd code, it returns the same value as it gets, while using the 1st code it returns expected value.