MATLAB: How could i write cell array containing cell array into a text file using fprintf

cell arraysfprintfnested cell arrays

hi guys , i have used this code to write this cell array into a text-file, but the the text-file i got is adding some abnormal numbers beside the numbers contained in the cell array!!!!
C5 = X;
fid5= fopen('X_file.txt', 'w');
for h=1:217
fprintf(fid5, '%s\t %s\t %s\t %f\t ', C5{h}{:});
fprintf(fid5,'\t');
fprintf(fid5,'\n');
i got like this which is exist here"X-fileoutput" end fclose(fid5);

Best Answer

Your cells all contain character vectors, but you include a %f element, which tells MATLAB to expect a numeric element there. The 45.0 that you see are the %f representation of char(45) which is the '-' that just happens to be present in your character vectors.