matlab中的textread的用法问题

feng19 2009-05-14 08:45:35
我在使用matlab的过程中,写了一个程序,里面用到了textread,里面有这样的语句:
for i=0:100000,
filename=[fi,'rand_',num2str(i),'.txt'];
[motifs,motif_num]=textread(filename,'%s\t%d');
end
结果总是运行不了多久就显示 cache memory exhauted.
我觉得是textread的问题。因为我要读很多文件,每次读一个,但是读之后没有关掉,浪费了资源。
但是经过查找,我找不到如何关闭用textread读取文件的函数。因为实际上我也没有用fopen之类的打开的命令,请教该怎么办,谢谢。
...全文
3506 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fystme 2009-06-17
  • 打赏
  • 举报
回复
Note The textscan function is intended as a replacement for both textread and strread.
textscan

Read formatted data from text file or string
Syntax

C = textscan(fid, 'format')
C = textscan(fid, 'format', N)
C = textscan(fid, 'format', param, value, ...)
C = textscan(fid, 'format', N, param, value, ...)
C = textscan(str, ...)
[C, position] = textscan(...)
Description

Note Before reading a file with textscan, you must open the file with the fopen function. fopen supplies the fid input required by textscan. When you are finished reading from the file, you should close the file by calling fclose(fid)
feng19 2009-05-17
  • 打赏
  • 举报
回复
自己顶

3,422

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 其他开发语言
社区管理员
  • 其他开发语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧