MATLAB: How to turn a number array into a specific string set

arraycell arraysnum2str

Hi,
I have an array of data (numbers) (set of 24) that I would like to turn into a string array and then add to a cell array (with a specified row) so it can be put into a GUI table. colorgen gives each specific cell a color background (given by the code http://www.mathworks.com/matlabcentral/answers/25038-how-to-change-each-cell-color-in-a-uitable). In order for this code to work the number data has to be a string. So for example, one element of the original array could be 722.845, which i would like to turn into '722.845', and then place into position data{3, 2}. But when I use the for loop, and get the numel (or size) or array_cell i get the number of characters in the array which is about ~300, and not 24 (which how many elements are in the original array) and the table prints out each character into one box. Help!
array_cell = num2str(array);
for i=1:numel(array_cell) %size(array_cell,2)
data{row,i+1} = colorgen(color, array_cell(i));
end

Best Answer

array_cell = num2str(array) I think is the problem. Try using the num2str within the for loop.
for i=1:size(array,2)
data{row,i+1} = colorgen(color, num2str(array(i)));
end