Monday, March 08, 2010

Matlab: Convert numerical array to cell with string representation of numbers

Short Matlab script that takes an array (i.e. vector) of numbers and returns cell with fileds that are string representation of the numbers in the array.For example: >> a=[1 2 3.24 -43 4.56];
>> numarray2cellstring(a)

ans =

'1' '2' '3.24' '-43' '4.56'