| xPC Target™ | ![]() |
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)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. |
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'
Open the file for reading (default). The method does nothing if the file does not already exist.
'w'
Open the file for writing. The method creates the file if it does not already exist.
'a'
Open the file for appending to the file. Initially, the file pointer is at the end of the file. The method creates the file if it does not already exist.
'r+'
Open the file for reading and writing. Initially, the file pointer is at the beginning of the file. The method does nothing if the file does not already exist.
'w+'
Open the file for reading and writing. The method empties the file first, if the file already exists and has content, and places the file pointer at the beginning of the file. The method creates the file if it does not already exist.
'a+'
Open the file for reading and appending to the file. Initially, the file pointer is at the beginning of the file. 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).
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);xPC Target™ file object methods fclose, fread, and fwrite.
MATLAB fopen function.
![]() | filetable | fread | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |