3.0

3.0 | 2 ratings Rate this file 64 downloads (last 30 days) File Size: 3.28 KB File ID: #16269

addpathsvn

by Ryan Ollos

 

06 Sep 2007 (Updated 18 Nov 2008)

Add a subversion directory tree to the MATLAB search path

Download Now | Watch this File

File Information
Description

ADDPATHSVN appends path names from a subversion directory tree to the MATLAB search path. This function will ignore the '.svn' directories that exist in each directory under version control, as well as a list of full or partial path names that you specify. The function could easily be modified to work with a cvs directory tree, and probably other version control systems as well.  
 
This function is extremely useful in situations where a directory tree is constantly changing, and you do not want to worry about keeping your MATLAB search path up to date manually.  
 
By modifying and then adding the following bit of code to your startup.m file, your directory tree will be added to the MATLAB search path at startup, provided that addpathsvn and its subfunction are already on the MATLAB search path.  
 
% path to working copy of repository  
  reposPath = '~/svnwork';  
 
% list of directories to ignore  
  ignoreList = {'dir1', 'dir2', ... }  
 
% add svnwork and all subdirectories to % the matlab search path addpathsvn(reposPath,'RECURSIVE',ignoreList);  
 
% clear variables from workspace  
  clear variables;  
 
 
Please contact me if you find any bugs or have suggestions for improvement.

MATLAB release MATLAB 7.4 (R2007a)
Zip File Content  
Other Files genpathverctl.m,
addpathsvn.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
01 Apr 2008 Anna Kelbert Nice and convenient, thanks. Hopefully someday Matlab will improve addpath(genpath(dir)) by adding a second argument (exceptions) to genpath. In the meanwhile, this is a more portable solution than overwriting the genpath function.  
 
A bug report: the function crashed on me when I tried running addpathsvn recursive on a directory that didn't have any subdirectories. Inserting these lines after the line 99  
   if ischar(pathList)  
      pathList = { pathList };  
   end  
fixed the problem.
21 Nov 2008 Thierry Dalon Wow! Code is pretty complicated! 
Modifiying the original genpath function to take ignore input and put it as subfunction in your addpathsvn function would be easier and more optimized. Here you still call genpath fully and then filter out the input. See other FX 21086 implementation. 
  
Please login to add a comment or rating.
Updates
11 Sep 2007 Fixing typos in Keywords.
05 Feb 2008 Fixing typos in Description.
18 Nov 2008 Bugfix provided in comment by Anna Kelbert.

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com