Converts a table or dataset to a formatted character matrix.
Aktualisiert 7. Sep 2017

Lizenz anzeigen

Helper function which converts a table/dataset to a compactly formatted character representation (in analogy to NUM2STR). It also makes the table more human readable by only showing the relevant digits, removing unnecessary zeros, the boldfont control commands added in the TABLE display and more.
The function can handle multi-dimensional columns of many types. The string representation is useful for storing the table in a text file or appending it to other text data (e.g. as UserData in a figure).

Zitieren als

David J. Mack (2024). table2char(data,varargin) (, MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2012a
Kompatibel mit allen Versionen
Windows macOS Linux
Mehr zu Characters and Strings finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise

- [MOD] Major code mod. Outsourced several routines to sub-functions to make the code more maintainable. Changed the style to adhere to Matlab Code Rules.
- [FIX] Error when a variable name is shorter than its unit.

[FIX] Error when printing row names & units

[FIX] Error for columns containing only 1 finite negative and otherwise NaNs.

[FIX] Rounding to one problem.
Added the updated file.

[ADD] Added the optional input 'AddUnits' to specify if the variables' units should be added to the output.

Corrected a typo.
Forgot to update the file.
FIX: Further fix for the rounding to zero problem.
FIX: Disappearing digits when rounding to a column's precision increased the number of integer digits.

Now shows if a value is 0 after rounding to the column's precision.