fwrite - Write binary data to open target PC file

Syntax

MATLAB® command line

fwrite(file_obj,file_ID,A)
file_obj.fwrite(file_ID,A)

Arguments

file_obj

Name of the xpctarget.fs object.

file_ID

File identifier of the file to write.

A

Elements of matrix A to be written to the specified file.

Description

Method of xpctarget.fs objects. From the host PC, writes the elements of matrix A to the file identified by file_ID. The data is written to the file in column order. The file_ID argument is the file identifier associated with an open file (see fopen). fwrite requires that the file be open with write permission.

Examples

Open the file data.dat in the target PC file system object fsys. Assign the resulting file handle to a variable for writing.

h = fopen(fsys,'data.dat','w')

or

fsys.fopen('data.dat','w')
ans =
     2883584
d = fwrite(fsys,h,magic(5));

This writes the elements of matrix A to the file handle h. This content is written in column order.

See Also

xPC Target™ file object methods fclose, fopen, and fread.

MATLAB fwrite function.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS