![](https://csdnimg.cn/release/download_crawler_static/87517815/bg5.jpg)
> 0 Move toward the end of the file.
= 0 Do not change position.
< 0 Move toward the beginning of the file.
origin 表示位置指针移动的参照位置,ORIGIN values are interpreted as
follows:
'bof' or -1 Beginning of file
'cof' or 0 Current position in file
'eof' or 1 End of file。若定位成功,status 返回值为 0,否则返回值为
–1。
ftell 函数返回文件指针的当前位置,其调用格式为:
position=ftell (fid)
返回值为从文件开始到指针当前位置的字节数。若返回值为–1 表示获取文件当
前位置失败。
例:FID=fopen('sw.m','r')
fseek(FID,10,-1)
ans =
0
>> ftell(FID)
ans =
10
>> fseek(FID,-10,1)
ans =
0
>> ftell(FID)
ans =