Matlab: Converting a Cell with Double values to String -
i need command converts a={1 2 3} a={'1' '2' '3'}. in other words, want input a={1 2 3} converted {'1' '2' '3'}.
here 1 alternative using sprintfc (undocumented helper function)
out = sprintfc('%d',cell2mat(a)) output:
out = '1' '2' '3' while %d refers integers, might use %.4f (where .4 refers number of decimal digits after decimal point) floating point numbers.
for example,
out = sprintfc('%.3f',cell2mat(a)) output:
out = '1.000' '2.000' '3.000'
Comments
Post a Comment