User`s guide
fopen
14-24
14fopen
Purpose 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
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
•
'r' to open the file for reading (default)
•
'w' to open the file for writing. The method creates the file if it does not
already exist.
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.
file_obj
Name of the xpctarget.fs object.
'file_name'
Name of the target PC to open.
permission
Values are 'r' or 'w'. This argument is optional
with
'r' as the default value.