Skip to content
Snippets Groups Projects
Select Git revision
  • a89978078a54fc9ff819d023da9fbd7e8058004f
  • master default protected
2 results

file2mat.cc

Blame
  • Martin Karlsson's avatar
    Martin Karlsson authored
    a8997807
    History
    file2mat.cc 497 B
    #include "cuttraj.h"
    #include <iostream>
    #include <armadillo>
    
    using namespace arma;
    using namespace std;
    
    
    mat file2mat(const string& filename, mat& y) {
    	mat yTemp;
    	yTemp.load(filename, raw_ascii);
    
    	
    	y = zeros<mat>(yTemp.n_rows, yTemp.n_cols);
    
    	
    	double dTemp;
    	for (int i = 0; i < y.n_rows; ++i) {
    		for (int j = 0; j < y.n_cols; ++j) {
    			dTemp = yTemp(i,j);
    			y(i,j) = dTemp;
    		}
    	}
    	cout << y.n_rows << endl;
    	cout << y.n_cols << endl;
    	
    	y = ones<mat>(yTemp.n_rows, yTemp.n_cols);
    	
    }