Code covered by the BSD License  

Highlights from

3.5 | 2 ratings Rate this file 10 Downloads (last 30 days) File Size: 1.57 KB File ID: #30370 Version: 1.0




Checks for and displays user specific path definitions

| Watch this File

File Information

Working on several projects - m-files each in a separate folder - needs the knowledge about the current folder in the search path. IsPath checks for user specific folder(s) in the search path.
p = IsPath(<foldername>); %returns true or false

p = IsPath; %returns a string with all user specific path(s). Can be used by rmpath(p) to remove all specific path definitions

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
28 Mar 2012 Ben

Ben (view profile)

Thanks! Saved me from having to write this myself!

Comment only
28 Mar 2012 Ben

Ben (view profile)

15 Feb 2011 Evgeny Pr

Evgeny Pr (view profile)

@Jan Simon,
RandStream this is the class. For class names is well-suited. I agree that the functions can be called a convention "camelCase" (for example: fastSort).

Comment only
13 Feb 2011 Jan Simon

Jan Simon (view profile)

@Evgeny: Using (sulking)camel-case for user defined functions has a great advantage: If someone reads the code, it is obvious, if a certain function is user-defined or a toolbox function of Matlab -- but e.g. RandStream is not lower case also.

Comment only
11 Feb 2011 Evgeny Pr

Evgeny Pr (view profile)

fix: outs = false(size(MyPaths))

4. For support crossplatform need to check the case-sensitive file system.

5. Rename IsPath to ispath (good MATLAB coding style)

This trivia :)

Comment only
11 Feb 2011 Evgeny Pr

Evgeny Pr (view profile)


1. You need to remove the last file separator (or all excess separators) in checked path.

IsPath('mypath') => true
IsPath('mypath\') => false

2. More simple check method (instead of loop):
if isempty(intersect(MPath, Pfad))
tf = false
tf = true

3. Supports checking multiple paths
IsPath({'mypath1', 'mypath2', 'mypathN'})
Out for example:
0, 1, 0

MyPaths - cell array of checked paths

outs = false(numel(MyPaths))
[~, inds] = intersect(MyPaths, MPath)
outs(inds) = true;

Good luck!

Contact us