MATLAB: Print content of a double to a table

tables

Hey guys,
I am trying to unite four cells in one table. Before I concatenated the four cells like A = [T, D ; time, Dynamics]. The two top cells (T, D) contain text or strings. The two bottom cells both contain 222×1 doubles. When I convert A to a table using cell2table(A) I get the following output:
Scans =
2×6 table
Scans1 Scans2 Scans3 Scans4 Scans5 Scans6
______________ ______________ ______________ ______________ ______________ ______________
'Time' 'Scan 1' 'Scan 2' 'Scan 5' 'Scan 17' 'Scan 25'
[222×1 double] [222×1 double] [222×1 double] [222×1 double] [222×1 double] [222×1 double]
Is there a way two display the contents of the 222×1 doubles?
The reason why I need this is that I riqurie the first row of the table to contain these strings since the data in 'Scans5' do not belong to scan 5 but to scan 17.
Please find my code used in the following (don't care about the origin of the cells time and Dynamics):
b_1 = [1, 2, 5, 17, 25];
c_1 = numel(b_1);
D = cell(1, c_1);
for k = b_1
tmp = sprintf('Scan %g', k);
D{k} = tmp;
end
D = D(~cellfun('isempty',D));
u = sprintf('Scan %g', 1);
T{1} = u;
Scans = [T , D; time, Dynamics]; %Time (1x1 cell and Dynamics (1xc_1 cell) both contain 222×1 doubles
Scans = cell2table(Scans);
display(Scans);
Thanks for your help,
Best,
Sven

Best Answer

A column in MATLAB's table can hold data of a single type. If you want to use all values, then you cannot have the first row with char arrays. Try this
b_1 = [1, 2, 5, 17, 25];
c_1 = numel(b_1);
D = cell(1, c_1);
for k = b_1
tmp = sprintf('Scan %g', k);
D{k} = tmp;
end
D = D(~cellfun('isempty',D));
u = sprintf('Scan %g', 1);
T{1} = u;
Scans = [T , D; {rand(222,1)}, {rand(222,1),rand(222,1),rand(222,1),rand(222,1),rand(222,1)}]; %Time (1x1 cell and Dynamics (1xc_1 cell) both contain 222×1 doubles
Scans = array2table([Scans{2,:}]);
display(Scans);