For and If loop

Hi,

How can i record the value tdlock_start and tdlock_end just just after the
if (datavector[i]<co) ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
double co=0.2, tdlock_start=0, tdlock_end=1e20, tlock_start=0, tlock_end=1e20;
  for(int i=0; i<datasize; ++i) {
    t= (double)start + (double)i*(stop-start)/(double)datasize;

    if (datavector[i]<co)

      { 
       if(t > tdlock_start) tdlock_start=t;
        
       if(t < tdlock_end) tdlock_end=t;
	}

    else 
      
      {
       if(t > tlock_start) tlock_start=t;

       if(t < tlock_end) tlock_end=t;
      }
Last edited on
You could write it to a log file.
Topic archived. No new replies allowed.