MATLAB: Table function: control number of significant figures & delete quotation marks in the outputs

characterdoubleprecisionquotationsignificant figuressprintfstringtable

Hi all,
I have a cell array named Data (as you can see below) and I would like to make its numbers appear using the specific code below in a table, which works fine. The problem is that I would like to control the number of significant figures (which I do) however, since sprintf converts my numbers in to strings, the output table has quotation marks on each value which does not make it presentable (I would like to put the table straight into my report).
Do you have any ideas as to how i can make the quotation marks disappear, yet still control the format of my numbers to be inserted in the table? Thanks in advance for your help. Below is the code:
Data={rand(2,3),rand(2,3),rand(2,3)...
rand(2,3),rand(2,3),rand(2,3)};
%Tabulate Results
%Preallocate cell size
vec_1=cell(1,1);
vec_2=cell(1,1);
vec_3=cell(1,1);
for i=1:size(Data,2)
vec_1(i,:)={sprintf('%.1f',Data{i}(1,1)*100)};
vec_2(i,:)={sprintf('%.1f',Data{i}(1,2)*100)};
vec_3(i,:)={sprintf('%.1f',Data{i}(1,3)*100)};
end
RowN={'n1';'n2';'n3';...
'n4';'n5';'n6'};
Table1=table(vec_1,vec_2,vec_3,'RowNames',RowN);

Best Answer

Sorry, no formatting controls are provided for table() objects.
d2 = cellfun(@(M) M(1,:), Data, 'Uniform', 0);
Table1 = array2table(round(100*vertcat(d2{:}),1), 'RowNames', RowN);