matlab中fid=fopen('magic.m','r') 其中fid 和 r 分别代表什么含义

如题所述

第1个回答  推荐于2018-03-01
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值表示是否成功本回答被提问者和网友采纳
相似回答