I am working on a project which is a numerical simulation . I was wondering if somebody could help with some data representation issues. As with any simulation results , I need to generate graphs , but i guess C++ isn't the best option for that. So I used an external library (dislin) to display plots. This has been helpful in quick plots just to trouble shoot small fragments of the code. But I realized that since I need to run whole simulation for a much longer time , i will be having lots of graphs. And dislin doesn't seem to be the brightest option.
So i started writing the data to excel , The main problem is , i have to do tens of thousands of iterations, and simultaneously save the calculated quantities before i update the values , but since I wasn't able to manipulate the rows and columns where i am writing the data , there was a lot of time being spent in organizing the data which i got in excel. I am not familiar with advanced topics in c++ like OOP n all , i have very basic knowledge in classes and objects that's about it..
As of now my code is pretty simple , just using dynamic arrays and vectors, I've been trying to find good tutorials or good references , but I just end up spending too much time googling , and bombarded with a lot of programming jargon.
No there is no speed issue, What would be the easier way to write the output to a file. Write now i'm just writing it to excel, but as the number of iterations increase , the values just gets appended to the end of the lvalues from last iteration.. So after the simulation i need to manually select the appended data and put it in new columns.
When you say you are writing to Excel, do you mean that you are outputting a CSV file? Or are you using some API to write directly to an Excel document?
Actually just writing file in .xls format. i'm using just basic file writing option. Not sure how to use API . D oyou think thats a better option? Any tutorials you know I could refer?
I have no idea what .xls file format looks like. However Excel accept CVS CSV files as input which are simple to generate.
If you want to continually add columns, then you could read in each line of the file, append the new columns to that row and then write the new data to a different file.
A bit like this:
1 2 3 4 5 6 7 8 9
std::ifstream ifs("data-in.csv");
std::ofstream ofs("data-out.csv");
std::string line;
while(std::getline(ifs, line))
{
line = line + new_columns();
ofs << line << std::endl;
}