Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- FILE *fp;
- char line[80],*pch;
- int points[1000][10];
- int centroid[1000][10];
- float distance[1000][10];
- int noofpts=0,noofvar=0,noofcentroids=0;
- int i=0,j=0,k;
- fp=fopen("kmeans.dat","r");
- while(fgets(line,80,fp)!=NULL)
- {
- j=0;
- pch=strtok(line,",");
- while(pch!=NULL)
- {
- points[i][j]=(int)pch;
- pch=strtok(NULL,",");
- noofvar++;
- j++;
- }
- noofpts++;
- i++;
- }
- noofvar=noofvar/noofpts;
- printf("No of points-%dn",noofpts);
- printf("No of variables-%dn",noofvar);
- return 0;
- }
- points[i][j]=(int)pch;
- points[i][j]=atoi(pch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement