start matlab with relative path
2 views (last 30 days)
Show older comments
Dario Vazquez
on 8 Feb 2018
Commented: Walter Roberson
on 8 Feb 2018
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 :)
0 Comments
Accepted Answer
Walter Roberson
on 8 Feb 2018
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 Comment
Walter Roberson
on 8 Feb 2018
For example,
matlab -r "try;run('\\folder1\\folder2\\ducttape.m'); end; quit"
More Answers (0)
See Also
Categories
Find more on Adding custom doc in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!