Stem and Leaf function
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 (2026). Stem and Leaf function (https://www.mathworks.com/matlabcentral/fileexchange/4343-stem-and-leaf-function), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
