Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to output the data set when using histogram in mathematica

In Mma, the Histogram function only generates graphics. I am wondering how I can to get the data set; is there any convenient built-in function for this?

Many thanks.

like image 910
Qiang Li Avatar asked Dec 08 '25 01:12

Qiang Li


1 Answers

HistogramList was added to Mathematica V8 to expose the binning and height calculations.

HistogramList[a]

enter image description here

For V7 you can hack the third argument to get the bins and counts.

Histogram[a, Automatic, (Print[{##}]; #2) &]

enter image description here

like image 132
Brett Champion Avatar answered Dec 13 '25 09:12

Brett Champion