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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -