num2cellstr

版本 1.0.0.0 (1.1 KB) 作者: Andrew Watson
num2CellStr converts numeric or logical array to a cell array of strings
1.3K 次下载
更新时间 2008/7/10

无许可证

num2CellStr - converts numeric or logical array to a cell array of strings

This was inspired by a recent FEX submission of the same name. However,
it should run about 100 times faster. It also runs ~12 times faster than
the one liner:

cellA = reshape(cellstr(num2str(A(:))),size(A));

Syntax:

strCell = num2CellStr(x, format)

Input parameters:

x - mandatory matrix of numeric values
format - optional format specifier. If not specified one is
picked based on the data up to 5 decimal places

Output parameters:

strCell - cell array of strings

Examples:

num2CellStr(rand(2),'%.2f')

ans =

'0.06' '0.61'
'0.13' '0.39'

See also:
num2cell, mat2cell, textscan, strread

引用格式

Andrew Watson (2026). num2cellstr (https://ww2.mathworks.cn/matlabcentral/fileexchange/20639-num2cellstr), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2007b
兼容任何版本
平台兼容性
Windows macOS Linux
版本 已发布 发行说明
1.0.0.0