在MATLAB中存在(x,'文件')永远占用 [英] In MATLAB exist( x, 'file' ) takes forever

查看:379
本文介绍了在MATLAB中存在(x,'文件')永远占用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 exist(x,'file') 检查我的机器上是否存在文件。



我的 matlabpath 不是太长(大约200个条目),路径上的所有文件夹都在我的本地驱动器(无网络)上。


  1. 为什么存在需要永久存在吗?

  2. 是否有办法让它运行更快?

PS,

这个对存在的调用是Matlab执行 loadlibrary 。所以,如果你正在调用 loadlibrary 并且你不知道为什么永远需要 ,那么这个问题也适合你。 b $ b

解决方案

哇!这是一个艰难的。底线:删除%TEMP%个文件!



我有几千个文件在%TEMP%。看来 MATLAB 真的很喜欢反复使用TEMP目录。



清除TEMP文件夹后,存在立即运行!

(感谢Andrew对过程监控的建议!)


I am using exist(x, 'file') to check for the existence of a file on my machine. The execution of this command takes FOREVER (over 10 seconds per call!).

My matlabpath is not too long (about 200 entries) and all folders on path are on my local drive (no network).

  1. Why does exist takes forever?
  2. Is there a way to make it run FASTER?

PS,
This call to exist is part of Matlab's execution of loadlibrary. So, if you are calling loadlibrary and you don't know why it takes forever - this question is also for you.

解决方案

Wow! That was a tough one. Bottom line: Delete %TEMP% files!

I had a few thousands files lying around in %TEMP%. It appears MATLAB really likes to go over and over the TEMP directory.

After clearing the TEMP folder, exist runs in no time!

(Thanks Andrew for the Process Monitor advice!)

这篇关于在MATLAB中存在(x,'文件')永远占用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆