我试图读取文件的顺序与textscan
有效的文件标识符,但我不断收到此错误:无效的文件标识符。使用的fopen产生
Error using textscan Invalid file identifier. Use fopen to generate a valid file identifier.
我的代码是:
fd = fopen(['D:\Thesis\Data\vedai_co_75_25\train\labels\' files(id).name],'rt');
line = textscan(fd, '%s %f %d %f %f %f %f %f %f %f %f %f %f %f %f');
当我尝试看看的['D:\Thesis\Data\vedai_co_75_25\train\labels\' files(id).name]
输出返回正确路径:
D:\Thesis\Data\vedai_co_75_25\train\labels\00000000.png
还命令fopen(D:\Thesis\Data\vedai_co_75_25\train\labels\00000000.png)
返回或或等
但是命令fopen(['D:\Thesis\Data\vedai_co_75_25\train\labels\' files(id).name])
返回-1。
我该如何做这项工作?
仅供参考,我的系统上这两个命令工作,不返回** - ** 1(有或无字符串连接)。我在Linux上,似乎你在Windows上。 – UJIN
@UJIN是的,我正在使用Windows。第二个命令在** for循环**中,所以我不能像第一个那样使用它。 –
是的,我知道你需要使用第二个版本。不幸的是,我无法重现您所遇到的行为,两者对我而言都很好。您将不得不等待可以使用Windows的人员,也可能使用Windows。 – UJIN