This function converts a numeric vector into a cell vector of strings. Each element of the cell contains the string conversion of the corresponding entry in the numeric vector, prefixed and postfixed by strings provided by the user. The format for numeric to string conversion can also be specified.
Useful for creating legend labels or tick labels.
Marco Cococcioni (2021). NUM2LAB (https://www.mathworks.com/matlabcentral/fileexchange/20698-num2lab), MATLAB Central File Exchange. Retrieved .
Thank you Jos! I have updated the submission using your suggestion!
Better to use the oneliner:
V = [1 2 3 4.5 6 pi] ;
prestr = 'Text before '
poststr = ' .. and after '
formstr = '%.2f' ;
C = cellstr(num2str(V(:),[prestr formstr poststr]))
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!