Hello, i have problems trying to export a TVectorD in a log file.
I made a routine that runs the PCA with TPrincipal (still trying to understand how it works), and i created a vector that gets the eigenvalues:
Now i want to create a file with the eigenvalues, so I tried with a TFile:
TFile *lambda = new TFile("lambda.root", "RECREATE");
eigen_values->Write();
lambda->Close();
THe file lambda.root is full of strange symbols and gedit says that it has problems. I can’t obtain a proper result like the one that i would obtain with a Print();.
You cannot open ROOT files with a text editor. It’s a binary file format. If you want to save to a text file, just print each component into the usual FILE* or std::ostream.
Now i tried to create a FILE*, but i don’t have any better result because i can’t recursively read a TVectorD and print it into a file directly, neither I can first assign it to a different array and then print it to a file.