how can i read data file by C++?


i have a matlab output data with more than 600,000 rows and 4 columns.
i want to read this file by C++ and put it in same array for next data processing, while i don't know how can i do it. please introduce me for doing it.


1. What is the format of the Matlab output?

2. What does "in same array" mean in this context?

3. Do I understand correctly that you have to compute something from a table of data and in order to do that you need to retrieve the table. You have to compute with means other than Matlab?
Dear Keskiverto
thank you for replying

1. my matlab output data is .xyz format ( 4 columns including ID, X, Y and Z coordination).

for example:

1 1.0932544897 3.6734259964 2.4527319633
. . . .
. . . .
. . . .



2. i want that C++ reads my file and put it in an array (600,000 rows and 4 columns)

3. i ran my code on matlab ago, but it was very slow because matlab works only with single processor.
therefore i decide to do it by C++, however i don't know how can i import data in C++ and save the result in the out put file.


Would unsigned int, double, double, double describe one entry?

Make a struct that holds those fields.
Reserve a vector.
Read each record into a struct and push it into the vector.
Do your analysis.

If you have not learned basics of C++ before, now is high time to do so.

Note that you have to learn threading, openmp, mpi, gpgpu, etc too in order to do parallel crunching.
Topic archived. No new replies allowed.