Hello. I would like to know how can export data from MatLab to a .txt file without loosing precision. I would like to export this data so I can do some computations using a C++ code I have. I've done some research, and I have found out that MatLab's double type (default type) has around 16 decimal digits of precision. Here is the code I've written:
x = rand(4,1);file = fopen('file.txt', 'w');fprintf(file, '%.15f\n', x);fclose(file);
I would like to know if this code is correct or if there is something I can improve. Thank you very much for your help!
Best Answer