start matlab with relative path

2 ビュー (過去 30 日間)
Dario Vazquez
Dario Vazquez 2018 年 2 月 8 日
コメント済み: Walter Roberson 2018 年 2 月 8 日
Hello,
Im using matlab for automated test of my firmware, what I do is open matlab, set the current folder to the firmware folder and run matlab script, matlab script will get data from source code and test the circuit automatically, i want to automate a little further and add this to my make file.
Im using cygwin and I can call Matlab by just sending the command 'matlab', what i want to do is be able to send something like this:
matlab '\folder1\folder2\' ducttape
please note that the address is relative, because when i call matlab from cygwin automatically the current forlder is set to the one of the project, I cant change the address to 'folder2' because the make file has to be run from the project folder.
'ducttape' is the scripts name.
e.g: cygwin is set to open in: 'C:\project\' so i can run make file by just calling make, and the data required by matlab file is on 'C:\project\folder1\folder2\', I dont want to hardwire the data address on the script because i may program diferent settins in 'C:\project\folder1\folder3' and want to be able to change between setups and test
Thank you :)

採用された回答

Walter Roberson
Walter Roberson 2018 年 2 月 8 日
You can use run() for scripts, providing a path to the script. run() works by doing a cd to the appropriate folder (and cd()'s back upon exit from the script.)
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 2 月 8 日
For example,
matlab -r "try;run('\\folder1\\folder2\\ducttape.m'); end; quit"

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAdding custom doc についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by