MATLAB: How to use a simple statement to describe a repeat format output about the function “fprintf”

fprintf

For example, fprintf(fid,'%4.2f %4.2f %4.2f %4.2f %4.2f',data) there are 5 '%4.2f', Can a simple statement like the (5'%4.2') to simplify the output format? I have no idea about it and do not find in the documents of matlab.

Best Answer

fprintf(fid,repmat('%4.2f',1,5),data)