MATLAB中~feof和feof有什么区别?
答案:2 悬赏:0 手机版
解决时间 2021-11-24 23:26
- 提问者网友:酱爆肉
- 2021-11-24 06:45
MATLAB中~feof和feof有什么区别?
最佳答案
- 五星知识达人网友:想偏头吻你
- 2021-11-24 07:57
函数feof(fid) 用法:文件指针 fid 到达文件末尾时返回“真”值;否则返回“假”;
~feof 是在 feof 前加了“非”,是逻辑表达式:文件指针到达文件末尾时 该表达式值为“假”;否则为“真”;
while ~feof 表示 若 未读到文件末尾 则 继续 循环
while feof 表示 若 未读到文件末尾 则 终止 循环,所以只循环一次就终止了,运行结果自然为0
这些都是程序设计的基本知识,你仔细想下就会明白的。
~feof 是在 feof 前加了“非”,是逻辑表达式:文件指针到达文件末尾时 该表达式值为“假”;否则为“真”;
while ~feof 表示 若 未读到文件末尾 则 继续 循环
while feof 表示 若 未读到文件末尾 则 终止 循环,所以只循环一次就终止了,运行结果自然为0
这些都是程序设计的基本知识,你仔细想下就会明白的。
全部回答
- 1楼网友:轻雾山林
- 2021-11-24 08:31
Description
eofstat = feof(fid) returns 1 if the end-of-file indicator for the file fid has been set and 0 otherwise. (See fopen for a complete description of fid.)
The end-of-file indicator is set when there is no more input from the file.
fgets (serial)
Read line of text from device and include terminator
Syntax
tline = fgets(obj)
[tline,count] = fgets(obj)
[tline,count,msg] = fgets(obj)
Description
tline = fgets(obj) reads one line of text from the device connected to the serial port object, obj, and returns the data to tline. This returned data includes the terminator with the text line. To exclude the terminator, use fgetl.
[tline,count] = fgets(obj) returns the number of values read to count, including the terminator.
[tline,count,msg] = fgets(obj) returns a warning message to msg if the read operation was unsuccessful.
eofstat = feof(fid) returns 1 if the end-of-file indicator for the file fid has been set and 0 otherwise. (See fopen for a complete description of fid.)
The end-of-file indicator is set when there is no more input from the file.
fgets (serial)
Read line of text from device and include terminator
Syntax
tline = fgets(obj)
[tline,count] = fgets(obj)
[tline,count,msg] = fgets(obj)
Description
tline = fgets(obj) reads one line of text from the device connected to the serial port object, obj, and returns the data to tline. This returned data includes the terminator with the text line. To exclude the terminator, use fgetl.
[tline,count] = fgets(obj) returns the number of values read to count, including the terminator.
[tline,count,msg] = fgets(obj) returns a warning message to msg if the read operation was unsuccessful.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯