2D Histograms

Hi,
I created a 2D histogram and I would like to save in a text file the bin contents in form of matrix.
At the moment I’m able to visualize it with the Draw option"text".
Thank you,
Valentina

for (int j=1;j<=ny;j++) { for (int i=1;i<=nx;i++) printf("%g ",h->GetBinContent(i,j); printf("\n"); }
Rene