fopen - Open target PC file for reading

Syntax

MATLAB® command line

file_ID = fopen(file_obj,'file_name')
file_ID = file_obj.fopen('file_name')
file_ID = fopen(file_obj,'file_name',permission)
file_ID = file_obj.fopen('file_name',permission)

Arguments

file_obj

Name of the xpctarget.fs object.

'file_name'

Name of the target PC to open.

permission

Values are 'r', 'w', 'a', 'r+', 'w+', or 'a+'. This argument is optional with 'r' as the default value.

Description

Method of xpctarget.fs objects. From the host PC, opens the specified filename on the target PC for binary access.

The permission argument values are

You cannot have more than eight files open in the file system. This method returns the file identifier for the open file in file_ID. You use file_ID as the first argument to the other file I/O methods (such as fclose, fread, and fwrite).

Examples

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

h = fopen(fsys,'data.dat') or fsys.fopen('data.dat')
ans =
     2883584
d = fread(h);

See Also

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

MATLAB fopen function.

  


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