FWRITE File Write Function
Section: Input/Ouput Functions
Usage
Writes an array to a given file handle as a block of binary (raw) data. The general use of the function isn = fwrite(handle,A)
The handle argument must be a valid value returned by the fopen
function, and accessable for writing. The array A is written to
the file a column at a time. The form of the output data depends
on (and is inferred from) the precision of the array A. If the
write fails (because we ran out of disk space, etc.) then an error
is returned. The output n indicates the number of elements
successfully written.
Example
Heres an example of writing an array of512 x 512 Gaussian-distributed float random variables, and then writing them to a file called test.dat.
--> A = float(randn(512));
--> fp = fopen('test.dat','wb');
--> fwrite(fp,A);
--> fclose(fp);
-->
quit
