開いているスクリプトのあるフォルダのパスを得る方法
显示 更早的评论
whichを用いることでそのスクリプトの名前を引数開いているスクリプトのパスを取得できますが,そのスクリプト名がパスに含まれます.
そのスクリプト名を含まない,そのフォルダまでのパスを取得する方法はありますか?
たとえばC:\Users\name\matlab\script.mlxに関して,script.mlxがあるフォルダのパス
C:\Users\name\matlab\を取得する方法が知りたいです.
采纳的回答
更多回答(1 个)
Kenta
2020-5-14
こんにちは、extractBefore関数を使うのはいかがでしょうか?以下のようにすればできると思います
path=which(script_name);
extractBefore(script_name)
类别
在 帮助中心 和 File Exchange 中查找有关 Communications Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!