Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compute a histogram() without plotting in matlab

Tags:

matlab

Is there a way to get the result object of a call to histogram() without the histogram plot? I want to use the results in a script without figures being generated.

Thanks.

like image 246
Cassio Pereira Avatar asked Mar 05 '15 13:03

Cassio Pereira


1 Answers

On octave you can use

values = hist(...);

without generating a plot. hist will also return the bin centers if you provide a second output argument. Note that Mathworks recommends using histogram and histcounts (see below) instead. You may also be interested in histc which takes the position of the bin edges as an input.

On current Matlab versions you can also use histcounts to get the bin counts and edges.

Please see also the documentation of hist and histcounts.

like image 140
Buck Thorn Avatar answered Oct 29 '22 15:10

Buck Thorn