28.12.2012 Views

Figure Properties - SERC

Figure Properties - SERC

Figure Properties - SERC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2fwrite<br />

Purpose Write binary data to a file<br />

Syntax count = fwrite(fid,A,precision)<br />

count = fwrite(fid,A,precision,skip)<br />

fwrite<br />

Description count = fwrite(fid,A,precision) writes the elements of matrix A to the<br />

specified file, translating MATLAB values to the specified precision. The data<br />

is written to the file in column order, and a count is kept of the number of<br />

elements written successfully.<br />

Examples For example,<br />

fid is an integer file identifier obtained from fopen, or 1 for standard output or<br />

2 for standard error.<br />

precision controls the form and size of the result. See fread for a list of<br />

allowed precisions. For 'bitN' or 'ubitN' precisions, fwrite sets all bits in A<br />

when the value is out of range.<br />

count = fwrite(fid,A,precision,skip) includes an optional skip<br />

argument that specifies the number of bytes to skip before each precision<br />

value is written. With the skip argument present, fwrite skips and writes one<br />

value, skips and writes another value, etc., until all of A is written. If precision<br />

is a bit format like 'bitN' or 'ubitN', skip is specified in bits. This is useful<br />

for inserting data into noncontiguous fields in fixed-length records.<br />

fid = fopen('magic5.bin','wb');<br />

fwrite(fid,magic(5),'integer*4')<br />

creates a 100-byte binary file containing the 25 elements of the 5-by-5 magic<br />

square, stored as 4-byte integers.<br />

See Also fclose, ferror, fopen, fprintf, fread, fscanf, fseek, ftell<br />

2-925

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!