Return each iteration of the loop

I need each value of the loop outside the loop without using array.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
		for(ii=0;ii<h;ii++){
			
			//LOOP for  scannig all six parameters
			for(i=0;i<6;i++){
				
				//Inserting Zero when data is missing
				Zero_out=obj.zero_padding(m,In_S[i]);
				
				//cout<<"Value of "<<dat_name[i]<<" After Zero Insersion["<<obj.index<<"]: "<<Zero_out<<endl;
				
				//Sampling after Five mintues
				Decimate_out=obj.decimatior(Zero_out);
				
				//Decimate function return 1 so it will print the requird value when it not equal to 1
				if(Decimate_out !=1){
	
				cout<<"Value after Decimate["<<obj.index<<"]: "<<Decimate_out<<endl;
				
				//delay for 1ms to send the data properly
				delay(1);
				
				//Convert Integer Data to the string
				snprintf(stt,sizeof(stt),"Value After Decimation[%d]:  %d",obj.index,Decimate_out);
				
				//Send the Result to the PC
				obj.stringsend(stt);
				
				}
			}
			//Increment in Indexx
			obj.index++;
			
			//checking the condition 
			if(h>1){
				
				//Increment in iteration for zero insertion if gap bigger than 1
				iter++;
				
			}
		}


Last edited on
I can't understand your question at all.
And I have no idea what your code is doing.

Post code in code tags: http://www.cplusplus.com/forum/articles/16853/

You've over-commented this piece of code. It's better to give an overview of the code block and then let the code speak for itself.

And I assume "decimatior" should be "decimator"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
for (ii = 0; ii < h; ii++) {

    for (i = 0; i < 6; i++) {

        //Inserting Zero when data is missing
        Zero_out = obj.zero_padding(m, In_S[i]);

        //cout << "Value of " << dat_name[i] << " After Zero Insersion[" << obj.index << "]: " << Zero_out << endl;

        //Sampling after Five mintues
        Decimate_out = obj.decimatior(Zero_out);

        //Decimate function return 1 so it will print the requird value when it not equal to 1
        if (Decimate_out != 1){
            cout << "Value after Decimate[" << obj.index << "]: " << Decimate_out << endl;
            delay(1);
            snprintf(stt, sizeof(stt), "Value After Decimation[%d]: %d", obj.index, Decimate_out);
            obj.stringsend(stt);
        }
    }

    obj.index++;

    if (h > 1)
        iter++;
}

thanks tpb!
I need Decimate_out value outside the loop after each iteration. Is it possible that?
Topic archived. No new replies allowed.