How to import .csv file data into gsl_vectors? C++
I have a .csv file that looks like: X,Y,Z -0.00624347,-0.0182673,1.00063 -0.00845628,-0.0374925,1.00058 -0.00494793,-0.0295639,0.927447 And I want to put it into three gsl_vectors (from GSL:https://www.gnu.org/software/gsl/doc/html/vectors.html) corresponding to the column X, column Y and column Z .I later want to use the functions that are implemented in the GSL on this data. I want to emphasize that these functions can only work on gsl_vectors and not on std:vectors. My approaches: 1. Put the data from the .csv into std:vectors, then transform those vectors into gsl_vectors. That did not work. 2. Put the data from the .csv file into gsl_vectors directly: https://code.sololearn.com/cA2a5A24a104 This gives no output on the Console and if I debug it, the function gsl_vector_set throws an exception: Exception thrown at 0x7A5EED1A (gsld.dll) in progr.exe: 0xC0000005: Access violation writing location 0x3333332, at gsl_set_vector's line: v->data[i * v->stride] = x; 3. Put the .csv data into a gsl_block and then slice it into gsl_vectors: https://code.sololearn.com/ca6a21A24A20 If I run this I get: Debug Error! abort() has been called And on the Console it is shown: gsl: C:\DEV\vcpkg\buildtrees\gsl\src\gsl-2-fb511965d5.clean\block\fprintf_source.c:90: ERROR: fscanf failed Default GSL error handler invoked. If I debug this, the gsl_error function throws an exception: progr.exe has triggered a breakpoint, at abort ();