LEGNUM Legend current figure using array of numbers. LEGNUM(X) adds a legend to current figure using string representations of the numbers in X. If X is a two- or multi-dimensional array, it will be flattened and all elements will be included.
LEGNUM(X, P) is the same but uses precision P, where P is an integer.
LEGNUM(X, P, S) same as above but includes a prefix string to each legend label.
Examples
>legnum(logspace(-5,-4,7), 6);
Adds a legend with logarithmically-spaced number labels, with 6 significant digit precision
> legnum(logspace(-5,-4,7), 6, 'x = ');
Same but labels are of the form 'x = 1e-5', etc.
See also NUM2CELLSTR
NUM2CELLSTR convert array of floating-point numbers to cell array of strings.
NUM2CELLSTR(X) converts array X to cell array of strings. If X is a two- or multi-dimensional array, it will be flattened (all elements will still be included).
NUM2CELLSTR(X, P) is the same but uses precision P, where P is an integer.
NUM2CELLSTR(X, P, S) same as above but includes a prefix string to each cell. This clumsy routine would be unnecessary if MATLAB provided something like python's string.strip() function.
See also SPRINTF, CELLSTR
Alex Barnett 12/5/02 |