function show_histogram(histogram,Vmin,Vmax) % show_histogram((histogram,Vmin,Vmax) plots in a figure % an histogram computed by the Signal Processing Blockset 'Histogram' % block and exported to the Matlab Workspace through a 'Signal to % Workspace' block. The 'Signal to Workspace' block has to be % configured to output a one-dimensional array. % % histogram is the name of the variable containing the histogram % as a one-dimensional array % Vmin, Vmax are, respectively, the minimal input value and % the maximal input value, as specified in the dialog box of the % 'Histogram' block. % compatible with Matlab R2012b if ~isnumeric(histogram) error('histogram is expected to be an array of numbers !'); end if ndims(histogram)>2 || (size(histogram,1)~=1 && size(histogram,2)~=1) error('histogram is expected to be a one-dimensional array !'); end Nbins=length(histogram); delta=(Vmax-Vmin)/Nbins; hx = Vmin+delta/2:delta:Vmax; hy = histogram; bar(hx,hy);