printf matlab code example
Example 1: save a text matlab
fileID = fopen('A.txt','w');
fprintf(fileID,'%15s %15s %15s\r\n','x','y','z');
nbytes = fprintf(fileID,'%15d %15d %15d\n',A)
fclose(fileID);
Example 2: fprintf matlab
A1 = [9.9, 9900];
A2 = [8.8, 7.7 ; ...
8800, 7700];
formatSpec = 'X is %4.2f meters or %8.3f mm\n';
fprintf(formatSpec,A1,A2)
Example 3: print in matlab
disp("this")
# or
fprint("this")