MATLAB: Engineering Notation Printed Into Files

engineering notationfprintfMATLABsadist

It seems logical to me that it would be easy to print values out into a file using engineering notation for the exponents, but apparently I'm horribly mistaken. Does anyone know how to do this? I have been googling and looking at help files for 2 days now, and still can't figure it out. I'm thinking it has something to do with the output format on fprintf that was clearly designed by a sadist, but what that format is I can't tell by any of the literature on the subject…

Best Answer

(Corrected as per Jan's catch of my typo)
format long eng;
fwrite(fid, evalc('disp(YourVariable)'))
Related Question