fprintf
Formatted output of numbers and strings to text files.
fprintf(fi, formatString, v1, v2, v3,...)
Inputs
fi The reference to a file that has been opened for output in the text mode.
formatString The format specified according to the standard C language.
{v1, v2, v3 ...} The list of variable to be printed according to the format string.


Description
If a variable is an array and the number of format specifications within the format string is less than the number of elements in the array, the list of format specifications is traversed cyclically till all the elements are written. This method is used sequentially for each of the variables that are to be output.
Example
>>a=rand(3,4)
>>a
    0.8937    0.0341    0.4218    0.9620
    0.7450    0.4891    0.7446    0.2077
    0.6824    0.6347    0.8586    0.8898
>> // Note that the array is output column by column.
>>fprintf(stdout,"%12.4f %12.8f %20.16f \n",a)
      0.8937   0.74495452   0.6824312135948638
      0.0341   0.48906726   0.6347462685793776
      0.4218   0.74458489   0.8586068483123598
      0.9620   0.20765775   0.8897757460594888
>>b=rand(2,3)
>>b
    0.8000    0.6958    0.9706
    0.5609    0.0452    0.8082
>>fprintf(stdout,"%12.4f %12.8f %20.16f \n",a,b)
      0.8937   0.74495452   0.6824312135948638
      0.0341   0.48906726   0.6347462685793776
      0.4218   0.74458489   0.8586068483123598
      0.9620   0.20765775   0.8897757460594888
      0.8000   0.56086620   0.6958052265988900
      0.0452   0.97060946   0.8081786412531674