马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
c++编程读取csv文件,621行,1000列的数据存进二维数组里面,数据都是double #include<iostream>
#include<stdio.h>
#include <cstdlib>
using namespace std;
double x[62][1000];
int main()
{
FILE *fp;
int row = 62, col = 1000;
int i, j;
fp = fopen("C:/Users/Administrator/Desktop/data/data/pca_dataset1.csv", "r");
for (j = 0;j<row;j++)
for (i = 0;i<col;i++)
fscanf_s(fp, "%lf", &x[j][i]);
int m,n;
int count = 0;
for (m = 0;m < row;m++)
for (n = 0;n < col;n++)
{
cout.setf(ios::fixed,ios_base::floatfield);
cout << x[m][n];
count++;
}
cout << endl;
cout << count;
fclose(fp);
//cout << x;
system("pause");
return 0;
}
|