I'm using 1 for fileID to write to the command window, and I put a newline in the end because it's prettier, but this should reproduce what you want
a = [10,20,200;20,30,300];
fprintf(1,'Speed, resistance, power%8.2f%8.2f%8.2f\n',a')
Speed, resistance, power 10.00 20.00 200.00
Speed, resistance, power 20.00 30.00 300.00
EDIT
Assume an array a
of unknown dimensions. Assume further that we want to fprint it row by row
a = [10,20,200;20,30,300];
%# find number of columns
nCols = size(a,2);
%# create format string for fprintf. Use repmat to replicate the %8.2f's
fmtString = ['Speed, resistance, power',repmat('%8.2f',1,nCols),'\n'];
%# print
fprintf(1,fmtString,a')
Speed, resistance, power 10.00 20.00 200.00
Speed, resistance, power 20.00 30.00 300.00
Note: This prints all rows of a one after the other on the same line (thanks, @JS).
fprintf('Speed, resistance,power')
fprintf('%8.2f',a')
fprintf('\n')