Hello Omid,
I'm assuming that what you want to label are the columns and not the rows.
We cannot run your code because we don't have acces to your "trainingdata".
But let's say you are able to produce a matrix (M) with size n x 4 like the one in the csv file you attached.
Then:
T=array2table(M); % Create a table from the matrix
T.Properties.VariableNames={'id','Absent','Present','Unknown'}; % Add the column headers
writetable(T,'NewFile.xls','WriteVariableNames',true);
Hope this helps!