When combining real and compex numbers within a single array, the array will appear in compex format. Here are some ways to format real and complex numbers.
If you're using R2021a or later, you can use the formattedDisplayText function to capture the display output as a string (documentation) and write that to file rather than using diary.
You can set the display format to remove trailing zeros but the command window display will remain in complex format. If you're writing these variables to file or to a user interface component such as a text box, that's a different story. See sprintf() and fprintf() and let us know if you have any followup questions.
Use compose to specify formating of real and imaginary components
To print a line of text that formats real and complex values individually,
complexStr = compose('%g%+gi', real(c(:)), imag(c(:)))
complexStr(isReal) = compose('%g', real(c(isReal)))
str = strjoin(complexStr', ', ')
cstr = reshape(complexStr, size(c))
Isolate the real and complex values within cell arrays
out = [mat2cell(c(:,1:2), ones(size(c,1),1),2), num2cell(c(:,3))]