fopen
Open file, or obtain information about open files
Syntax
fid = fopen(filename)
fid = fopen(filename, mode)
[fid, message] = fopen(filename, mode, machineformat)
[fid, message] = fopen(filename, mode, machineformat, encoding)
fids = fopen('all')
[filename, mode, machineformat, encoding] = fopen(fid)
Description
fid = fopen(filename) opens the file filename for read access. (On PCs, fopen opens files for binary read access.)
fid is a scalar MATLAB integer, called a file identifier. You use the fid as the first argument to other file input/output routines. If fopen cannot open the file, it returns -1. Two file identifiers are automatically available and need not be opened. They are fid=1 (standard output) and fid=2 (standard error).
简而言之,r表示打开问文件是为了读取数据
fid值表示是否成功