Stem and Leaf function

version 1.0.0.0 (1.34 KB) by Derek Barke
Creates a stem and leaf plot from an ARRAY of variables and a VECTOR x.

1.9K Downloads

Updated 9 Jan 2004

No License

function [stlmat,index] = stemnleaf(array,x)

Creates a stem and leaf plot of array, using bin edges defined by x and returns sparse matrices: stlmat and index containing the values in array and their indices (respectively) stlmat contains the full values in array in column - wise format, allowing the use of other functions such as SUM or LENGTH on the data.
%
% EXAMPLE:
%
% t = rand(10,1)
% bins = [-1 0 0.1 0.3 0.8 1.1 1.3]'
% [a b] = stemnleaf(t,bins);
% full(a)
%
% will return
t =
0.0185
0.2311
0.4447
0.4565
0.4860
0.6068
0.7621
0.8214
0.8913
0.9501

bins =
-1.0000
0
0.5000
1.1000
1.3000

% the command FULL(a) then gives:
>> full(a)

ans =

0 0.0185 0.6068 0
0 0.2311 0.7621 0
0 0.4447 0.8214 0
0 0.4565 0.8913 0
0 0.4860 0.9501 0
% where t is divided into bins:
-1.0 0 0.5 1.1 1.3

Cite As

Derek Barke (2022). Stem and Leaf function (https://www.mathworks.com/matlabcentral/fileexchange/4343-stem-and-leaf-function), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R12
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!