I think, this latest work-around work better than the original version.. However, I welcome any new suggestion.
sixEarly = (reshape ((result (:,1:96)),[12,8])).';
eightRoster = (reshape ((result (:,97:176)),[10,8])).';
sixLate = (reshape ((result (:,177:end)),[12,8])).';
% Do all the transformation under the function TABLECREATION
Tab_sixLate =tableCreation (at,sixLate);
Tab_sixEarly =tableCreation (at,sixEarly);
Tab_eightRoster =tableCreation (at,eightRoster);
function Table_Converted =tableCreation (at,NonConvertedCell)
Table_Converted = cell2table( NonConvertedCell ) ;
ListPat = (Table_Converted{:,1}).';
ListCondType = Table_Converted{1,:};
GetPatName = cellfun(@(v) v(1), ListPat(1,:));
GetCondType = cellfun(@(v) v(1), ListCondType(1,:));
% But still, I had to use two for loop here, mmm
for i=1:length (GetPatName)
Table_Converted.Properties.RowNames{i} = char ((at.sub.ID ((GetPatName(i)),1)));
end
for i =1:length (GetCondType)
Table_Converted.Properties.VariableNames{i} = char ((at.sub.Shiftday ((GetCondType(i)),1)));
end
end