files directory not found?
1 回表示 (過去 30 日間)
古いコメントを表示
GoodMorning, I ust want torun a script where it could give a value of zero if the selected directory doesn't exist.
It could be:
if dir C:\a == 'not found'
B=0
else
B=1
end
Actually i wanted an errormessage tho show up in gui, but that I can do by myself. Thanks
0 件のコメント
採用された回答
その他の回答 (1 件)
Stephen23
2015 年 3 月 11 日
if exist('C:\a', 'dir')==7
See the documentation for the list of output values.
2 件のコメント
Guillaume
2015 年 3 月 11 日
Well, if you specify the 'kind' (as 'dir'), then the output is either 7 or 0. Hence you don't actually need the comparison.
it does not hurt to be explicit though.
参考
カテゴリ
Help Center および File Exchange で File Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!