-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththist.m
More file actions
30 lines (26 loc) · 752 Bytes
/
thist.m
File metadata and controls
30 lines (26 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% THIST Histogram in terminal
%
% Usage
% thist(x, bins);
%
% Input
% x: The values whose histogram is to be displayed.
% bins: The bins for the histogram. If this is an array, these are the bin
% centers that are used. If this is a scalar, it indicates the number of
% equispaced bins to use, with bin centers calculated automatically
% (default 10).
%
% Description
% This function uses the standard hist function to calculate the histogram
% but displays it in the terminal using the tbar function instead of in a
% graphics window.
function thist(x, bins)
if nargin < 2 || isempty(bins)
bins = 10;
end
n = hist(x, bins);
if size(n, 1) == 1
n = n';
end
tbar(n);
end