我在
Windows下运行Matlab 7.8.0.
我使用dos()调用外部实用程序,它在当前目录中创建一个文件.
我正确创建了文件,但是存在或fopen无法看到它,它们分别返回0和-1.文件名是正确的!
>> pwd
ans =
I:\
>> ls
file1.asc file2.asc file3.asc
>> exist('file1.asc') % this file was there before
ans =
2
>> exist('file2.asc') % this file is newly created
ans =
0
确认它不是奇怪/有问题的文件名,我从Cygwin shell检查:
/cygdrive/i/ $if [ -f file2.asc ]; then echo "OK"; fi
OK
所以文件很好.我尝试重命名它
/cygdrive/i/ $mv file2.asc test
在Matlab中
>> ls
file1.asc file3.asc test
>> exist('test')
ans =
0
如果我退出并重新启动Matlab它工作正常.但我需要动态创建文件然后访问它!