1. 程式人生 > >將txt文件裡面的資料寫入矩陣中

將txt文件裡面的資料寫入矩陣中

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/ml/ml.hpp>
#include<iostream>
#include<fstream>
using namespace cv;
using namespace std;
int main()

 float labels[300][4] = { 0 };
 ifstream infile1;//定義讀取檔案流,相對於程式來說是in
 infile1.open("D:/300-w data/300W1/in_stan.txt");//開啟檔案
 for (int i = 0; i < 300; i++)//定義行迴圈
 {
  for (int j = 0; j < 4; j++)//定義列迴圈5
  {