MATLAB: Fprintf to print to both file and command window

fprintfloggingMATLAB

I'd like to run a single fprintf operation to print to both command window and file.
I know that the below command only print to 'log.txt' file:
fid = fopen('log.txt', 'w');
fprintf(fid, 'start logging\n');
And below will only print to command window:
fprintf('start logging\n');
Is there a way to print to both without calling fprintf twice?
Thanks,

Best Answer

I doubt it.
I'm not sure what your goal is, but it would certainly be trivial to write your own small function. Something like
function [] = writeToScreenAndFile(fid,str)
fprintf(fid, str);
fprintf(str);
end