Script does not use local path?

5 views (last 30 days)
Brian
Brian on 17 Dec 2015
Edited: Adam on 18 Dec 2015
I store code that I want all applications to share by releasing into a C:My Documents\Matlab directory. I work on it in a local directory to debug it and then copy it to this release directory, analogous to a \usr\bin directory. This is a poor man's code revision system.
I ran a script that was in the C:My Documents\Matlab directory. It used the version in C:My Documents\Matlab not the copy in the local directory. It seems that scripts choose the script / class that is local to their own directory rather than the directory of the path in the GUI.
  1. Is this an expected behavior?
  2. How do I implement this concept of release / debug?
  3. I could install TortiseSVN, Apache Subversion, or some other code revision control system. Is this the best way or is there another way or a product that works better with Matlab

Answers (2)

Adam
Adam on 17 Dec 2015
Edited: Adam on 18 Dec 2015
Your path is defined within Matlab and is just taken in the order things appear on the path, unless code is in a private folder in which case I think that is picked up before any other identically named functions elsewhere on your path. It doesn't matter where on disk code sits, so long as it is on the path. Having two copies of functions on your path is a lot of micro-management though if you have to keep switching them around. I would not recommend that as it is too easy to get it wrong.
Just type
path
to see your path or follow links at the bottom of
doc path
doc addpath
etc to see how you can manipulate your path. Usually I do it through the interface on the Matlab Home tab though.
  3 Comments
Adam
Adam on 18 Dec 2015
I'm not sure what you mean by 'local' path. As far as I'm aware there is just one path (for Matlab files).
Jordan Brouns
Jordan Brouns on 18 Dec 2015
You can add any folder in the matlab path

Sign in to comment.


Image Analyst
Image Analyst on 18 Dec 2015
Perhaps your current folder was actually the release folder instead of the working/test folder like you thought. If that's definitely not the case, then go to the Home tab on the tool ribbon and click setpath. You'll see the order of the search path. You will see that your release folder will be higher in the list than your test/working folder. There are buttons to move folders up and down in the priority list.
I also have a work folder. When I'm done and want to make an official copy I copy my files to a release folder and then "Commit" these files to the repository on the network shared drive with Tortoise Subversion.
MATLAB now has Subversion version control integrated into MATLAB. See this link: http://www.mathworks.com/help/matlab/matlab_prog/set-up-svn-source-control.html?s_tid=srchtitle

Categories

Find more on Source Control Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!