I need to locate an installed program in MacOS using Matlab, how can I do that?
1 回表示 (過去 30 日間)
古いコメントを表示
I need to locate an installed program in MacOS using Matlab, how can I do that?
My Matlab code needs to make sure a certain 3rd party program is installed on the computer running the matlab code.
I have a way to do it on Windows ('WHERE /F /R "C:\Users\...'), but how can I do it in Matlab?
0 件のコメント
採用された回答
Geoff Hayes
2019 年 8 月 22 日
Mårten - you could try something like
[status, path] = system('find ~/Documents/geoff -name myFile.m')
The above would search in all directories (and subdirectories) for a file named myFile.m. If the file can be found, then the path would be set with the location of that file.
2 件のコメント
Walter Roberson
2019 年 8 月 22 日
It can pay to first use system() of a 'which' command. which is a shell built in that looks on the Unix path.
In theory you could ask Spotlight about the file, but in my experience it is common for Spotlight to not find what I am looking for.
The unix find command can be slow, especially if you do not confine it to a single mount point (drive) and very slow if you somehow get it searching a Time machine volume.
Sometimes it is best to just try the most common locations like /bin and /usr/bin and /usr/local/bin and look in /opt where Homebrew tends to install, and look in the user's ~/Applications and similar, and look at environment variables for an appropriate name... And if it is not in those places then either prompt the user or force a configuration step be done. Looking through all the drives can take hours (I have more than 10TB these days.)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!