exist(x,'dir') slow for unavailable network drives
古いコメントを表示
I use exist(x,'dir') to check existence of a directory x. My problem is that checking existence of an address on a network drive when computer is not connected to the network takes something about 50 seconds. Checking existence of the address when computer is connected to the network however takes something about 0.0005 seconds.
I tried using
[a,b]=dos('net use x')
and I get list of connected network drives but it does not return the connected network drives as separate variable.
How can I speed up this process? I really appreciate any help!
4 件のコメント
Siddharth Sundar
2014 年 10 月 14 日
To check whether it is an issue with the operating system or specifically with the MATLAB function exist, try the following:
1) What happens when you try to access web pages when not connected to the internet?
2) Does the browser slowly resolve that it cannot find the file or does it give the 'not found' webpage quickly?
If it does take a long time to resolve that it cannot find the webpage, then I would think this might depend on operating system resolution attempting to connect to the web page and timing out.
Mohammad Abouali
2014 年 10 月 15 日
編集済み: Mohammad Abouali
2014 年 10 月 15 日
I don't have access to windows (yes it happens). when you issue
[a,b]=dos('net use x')
what do you get in a and b. Copy/Paste the result so we can help you to parse that.
Arsalan jamialahmadi
2014 年 10 月 16 日
Arsalan jamialahmadi
2014 年 10 月 16 日
回答 (1 件)
per isakson
2018 年 11 月 17 日
編集済み: per isakson
2018 年 11 月 17 日
I use exist(x,'dir') to check existence of a directory x. What's the value of x ?
Did you mean to run
num = exist( 'x:\', 'dir' );
which is fast enough whether 'x:\' exists or not.
3 件のコメント
Walter Roberson
2018 年 11 月 17 日
Including when the network is not connected?
per isakson
2018 年 11 月 17 日
編集済み: per isakson
2018 年 11 月 17 日
Good question. My guess is yes.
OP writes I get list of connected network drives and I guessed that x is her/his local drive letter.
Arsalan jamialahmadi
2018 年 11 月 17 日
カテゴリ
ヘルプ センター および File Exchange で Web Services についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!