Conversion

Type, format, and representation conversions — numbers to strings, structs to name-value cells, tables ↔ CSV.

When to use which

Task

Use

Format double as an exponential string (for axis labels)

double2estr(), double2expstr()

Format double as a fraction

double2fracstr()

Format double as a multiple of π

double2pifracstr()

Generic value → string

value2str()

Convert a numeric array to a cell of strings

num2cellstr()

Struct → {'k1', v1, ...} cell (ready for varargin)

struct2nvp()

Struct → 'k1', v1, ... string (for code)

struct2nvpstr()

Struct → literal MATLAB code text

struct2codestr()

MATLAB table ↔ CSV

table2csv(), csv2table()

Reference