# Output Histogram as Txt

**URL:** <https://root-forum.cern.ch/t/output-histogram-as-txt/41082>\
**Category:** Newbie\
**Created:** [August 20, 2020, 9:28pm UTC](https://root-forum.cern.ch/t/output-histogram-as-txt/41082 "2020-08-20T21:28:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![clkong](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@clkong](https://root-forum.cern.ch/u/clkong)\
**Post date:** [August 20, 2020, 9:28pm UTC](https://root-forum.cern.ch/t/output-histogram-as-txt/41082/1 "2020-08-20T21:28:54Z")

</div>

Hello everyone,

I have created a subtracted histogram through an C file that “the histogram is made by getting data from a root file (named A.root), then it is subtracted by data in other two roots (named B.root and C.root).”  
Is it possible that the final output is a list of data in txt format, instead of a graph in Canvas?  
For example, what should I do to scan the data such that those newly subtracted data are output to a txt file?

Thank you.

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [August 21, 2020, 9:53am UTC](https://root-forum.cern.ch/t/output-histogram-as-txt/41082/2 "2020-08-21T09:53:32Z")

</div>

Hi,

What would you like to output to the .txt file? The content of the bins? Please have a look at:

[https://root.cern.ch/doc/master/classTH1.html](https://root.cern.ch/doc/master/classTH1.html)

for the available API to extract information from a histogram.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 2, 2020, 10:29am UTC](https://root-forum.cern.ch/t/output-histogram-as-txt/41082/3 "2020-09-02T10:29:55Z")

</div>

```auto
.> h.txt
h->Dump()
.>

```

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [September 16, 2020, 10:40am UTC](https://root-forum.cern.ch/t/output-histogram-as-txt/41082/4 "2020-09-16T10:40:50Z")

</div>

Closed on September 16, 2020, 10:40am UTC

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