To read csv data file

I have the data file in the csv form. I am not able to read it although i have done for the .txt and .dat files .
Can anyone help me out in this ? is it possible to read the csv file in ROOT ?

Attach your cvs file and your macro which “fails”.

its not allowing me to upload the csv file format here,so i am attaching the converted text one,you may change that to csv one and then try doing it.and also i have the date format as dd/mm/yy,so i am not able to figure out how to deal with that too ?
the code is:-

{TNtuple calls("calls","calls","time:value");


calls.ReadFile("Cloud.csv");


TCanvas *a1 = new TCanvas("a1","canvas");
calls.Draw("value:time");

htemp->SetTitle("value ; time ; % deviation");
htemp->GetXaxis()->CenterTitle();
htemp->GetYaxis()->CenterTitle();
gStyle->SetTitleFontSize(0.06);
htemp->GetXaxis()->SetTitleSize(0.05);
htemp->GetYaxis()->SetTitleSize(0.05);
a1->SetFillColor(42);
Graph->SetMarkerStyle(7);
Graph->SetMarkerColor(4);


}

Cloud1.txt (1.5 KB)

Well, “csv” means “comma-separated values” and your “Cloud1.txt” file does not fit into this category.
You need to write a “parser” which “scans” it, retrieves values that you want and fills your tree (TTree::ReadFile will not automatically do it for you).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.