絶対パスから相対パスへ変更

MATLABで実行するときに現在は絶対パスを使用しています.ただほかの人に送ったときに実行ができないため相対パスに変更する方法はありますでしょうか。

2 Commenti

Kaede
Kaede il 2 Lug 2020
Mushra('C:\Users\Inoguchi\Music\mashram1\example_config.txt')
このような絶対パスで現在実行しています.
Kaede
Kaede il 2 Lug 2020
Mushra('..\mashram1\example_config.txt')
こちらで上手くいきました

Accedi per commentare.

 Risposta accettata

Shojiro SHIBAYAMA
Shojiro SHIBAYAMA il 13 Lug 2020

0 voti

作業フォルダを起点に相対パスを書くならば
[pwd '/relative/path/data.mat']
pwd コマンドを使うと良いと思います。
mfilenameという関数も場合によっては利用可能です。

Più risposte (0)

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!