how to covert double class to char class?

Hi everyone, I have a vector, for example A=[1 2 3]; normally saved as double class I want to convert it in to char class like eval= 1 2 3 to reduce the size of variable. Can you help me? Thanks

Answers (2)

Cedric
Cedric on 19 Jan 2013
Edited: Cedric on 19 Jan 2013
There would be
num2str( [1 2 3] )
or
num2str( A )
.. but what do you mean by "reduce the size of variable"? If it is the size in memory and you have only small positive integers, you might want to convert to uint8 or uint16.
Checkout the help on the following topics if you want to fine tune your conversion: numeric types, typecast, cast.

Categories

Asked:

on 19 Jan 2013

Community Treasure Hunt

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

Start Hunting!