Hello everyone,
I want to copy a vector from Matlab which contains 1000 values to Freefem, I tried to read the manual book but I can’t see how to do it! I don’t want to do it by hand because it’s too much! So, how to do it?
Thank you for any comments!
A blunt way to do this is to export the data from matlab as ascii, e.g. with save vector.txt -ascii yourvector
and then read it in with FreeFem in the following way:
int nol = 1000; // length of your vector
real[int] data(nol);
ifstream file1("vector.txt");
for (int cnt = 0; cnt < nol; cnt++){
file1 >> data(cnt);
}
Thank you very much! It works!