num2cellstr
Keine Lizenz
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
Zitieren als
Andrew Watson (2024). num2cellstr (https://www.mathworks.com/matlabcentral/fileexchange/20639-num2cellstr), MATLAB Central File Exchange. Abgerufen .
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
- MATLAB > Language Fundamentals > Data Types > Numeric Types >
- MATLAB > Language Fundamentals > Data Types > Characters and Strings >
- MATLAB > Language Fundamentals > Data Types > Data Type Conversion >
Tags
Quellenangaben
Inspiriert: Visualization of correlation matrix: mycorrplot_1, mycorrplot_2
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.0.0.0 |