Rank: 1430 based on 100 downloads (last 30 days) and 5 files submitted
photo

Jesse Hopkins

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Jesse View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
11 Feb 2013 Screenshot Scrolling Memory Monitor Displays recent history of Matlab & Java memory usage. Author: Jesse Hopkins memory, java 21 0
20 Jan 2012 issubclass Determines if a class is a subclass of another class. Author: Jesse Hopkins oop 16 0
26 Jul 2010 Screenshot Compression Routines Compress Matlab variables in the workspace. (supports cells, structs, matrices, strings, objects) Author: Jesse Hopkins compression java, compression 22 11
  • 3.0
3.0 | 1 rating
06 Nov 2009 Explore Convenient way to open windows explorer. Author: Jesse Hopkins windows explorer 11 5
  • 3.0
3.0 | 3 ratings
27 Oct 2009 genpath_exclude Executes like genpath, but can ignore specified directories. Author: Jesse Hopkins svn, cvs, cm, path 30 8
  • 5.0
5.0 | 4 ratings
Comments and Ratings by Jesse View all
Updated File Comments Rating
08 Apr 2014 genpath_exclude Executes like genpath, but can ignore specified directories. Author: Jesse Hopkins

craq - sorry I think the original version is long lost. However here's a hint from my memory:

dirs_str = genpath();
dirs_cell = regexp(dirstr,';','split');
matchstr = 'a[\\/]c|d[\\/]c'
dirmatch = regexp(dirs_cell,matchstr,'start','once');
matchidx = find(cellfun(@(x) isempty(x),dirmatch));
addpath(dirs_cell{matchidx});

07 Apr 2014 genpath_exclude Executes like genpath, but can ignore specified directories. Author: Jesse Hopkins

craq - I'll do a little digging and see if I can find my original version. On another note, one way I've done something similar to yours in the past is via 'private'. If there were folders that I didn't want to end up on the path, but that I might want to dynamically add later, i would encapsulate those directories in private.

i.e.
a/private/b, a/c, d/c.

Using this method, the directories under "private" won't be added by default, because genpath won't look underneath private, however if you can explicitly add "a/private/b" dynamically if you choose to do so later. Beware however, that right-clicking a folder in the file-browser and selecting "add folder and subfolders" WILL recurse through private directories. (I have submitted a bug report and apparently this behavior will be changed to be consistent w/ genpath in a future release).

05 Dec 2012 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Thanks for this useful tool! One quick note, around line 205 you use exist(..,'file') and exist(..,'dir'). I've found these to be problematic, as exist will return true if it finds the input anywhere on the matlab path.

This actually did cause an error in my case, when I passed in a directory called "Workspace". The directory had been deleted, however exist('Workspace','file') returns true due to workspace.m in the matlab install directory. The subsequent call do dir returned an empty matrix, causing an assignment error.

I've found the following functions more reliable for performing isdir/isfile type operations:
function x = myisdir(str)
x = false;
tmp = dir(str);
if length(tmp) > 1 % if str is a dir, then tmp will always contain at least '.' and '..'
x = true;
end

function x = isfile(str)
x = false;
tmp = dir(str);

if ~isempty(tmp) && length(tmp) == 1
if ~tmp.isdir
x = true;
end
end

25 Oct 2012 WHICHX File search within MATLAB search path using wildcards. Author: Elmar Tarajan

25 Oct 2012 Compression Routines Compress Matlab variables in the workspace. (supports cells, structs, matrices, strings, objects) Author: Jesse Hopkins

Hamid, glad you found this useful. Java is used to implement the compression, you can see this pretty clearly in the "compress" method. I haven't tried it, but I think it will work change the line "g = java.util.zip.GZIPOutputStream(f)" to "g = java.util.zip.ZipOutputStream(f)".

Comments and Ratings on Jesse's Files View all
Updated File Comment by Comments Rating
08 Apr 2014 genpath_exclude Executes like genpath, but can ignore specified directories. Author: Jesse Hopkins Hopkins, Jesse

craq - sorry I think the original version is long lost. However here's a hint from my memory:

dirs_str = genpath();
dirs_cell = regexp(dirstr,';','split');
matchstr = 'a[\\/]c|d[\\/]c'
dirmatch = regexp(dirs_cell,matchstr,'start','once');
matchidx = find(cellfun(@(x) isempty(x),dirmatch));
addpath(dirs_cell{matchidx});

07 Apr 2014 genpath_exclude Executes like genpath, but can ignore specified directories. Author: Jesse Hopkins Hopkins, Jesse

craq - I'll do a little digging and see if I can find my original version. On another note, one way I've done something similar to yours in the past is via 'private'. If there were folders that I didn't want to end up on the path, but that I might want to dynamically add later, i would encapsulate those directories in private.

i.e.
a/private/b, a/c, d/c.

Using this method, the directories under "private" won't be added by default, because genpath won't look underneath private, however if you can explicitly add "a/private/b" dynamically if you choose to do so later. Beware however, that right-clicking a folder in the file-browser and selecting "add folder and subfolders" WILL recurse through private directories. (I have submitted a bug report and apparently this behavior will be changed to be consistent w/ genpath in a future release).

07 Apr 2014 genpath_exclude Executes like genpath, but can ignore specified directories. Author: Jesse Hopkins craq

Thanks for this, it works exactly as advertised. One thing I'd like to do is match for a sequence of 2 directories (i.e. exclude a/b but include a/c and d/b). This doesn't seem possible from within genpath, but might be possible by parsing the output from genpath. According to the comments, you already did this in an older version. Would you be able to put this on the file exchange please? Or does anybody know how to access file history here?

08 Nov 2013 genpath_exclude Executes like genpath, but can ignore specified directories. Author: Jesse Hopkins RĂ¼land, Marcel

Thanks. Very simple and nice. To avoid warnings with package folders, i propose to ignore package folders by default. To do so replace line 81 with the following code:
if ~any(regexp(dirname,['^\.$|^\.\.$|^\@.*|^\+.*|^private$|' excludeStr ],'start'))

25 Oct 2013 genpath_exclude Executes like genpath, but can ignore specified directories. Author: Jesse Hopkins Woodford, Oliver

Works a treat.

Contact us