how to covert double class to char class?
Show older comments
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)
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.
1 Comment
Jan
on 19 Jan 2013
+1 for the suggestion to cast to UINT8.
Walter Roberson
on 19 Jan 2013
mat2str(A)
Categories
Find more on Numeric Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!