I am trying to read data from a file that contains ECG data. I have the file being open and all the numbers being stored into an array. I have a while statement to keep it running while I have data in the file. I am trying to get the code to read that data into one array and then sort them into another array. Whenever I do this it doesn't give me any errors but the command prompt comes up with nothing in it and it doesn't terminate. Am I storing into the other array wrong?
#include<stdio.h>
int main()
{
int X[128];
int R[128];
int S[128];
int peak;
int i = 0;
FILE*fp_read= NULL;
fp_read = fopen("ECG_data_128Hz_C.txt","r");
while(i<128)
{
fscanf(fp_read, "%dC", &X[i]);
//printf("%d\n",X[i]);
if(X[i]>110)
{
scanf("%d",&R[i]);
printf("R-Wave:%d\n",R[i]);
break;
}
else if(X[i]<-50)
{
scanf("%d",&S[i]);
printf("S-Wave: %d\n");
break;
}
//peak = R[i] - S[i];
//printf("Time between: %d\n",peak);
i++;
}
}
Aucun commentaire:
Enregistrer un commentaire