-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddMarmoPipe.m
57 lines (44 loc) · 1.67 KB
/
addMarmoPipe.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function varargout = addMarmoPipe()
% addMarmoPipe adds the required paths for MarmoPipe. It assumes that all
% paths are relative to this function
% where is marmoPipe?
marmoPath = fileparts(mfilename('fullpath'));
% dirs{n}='Import'; % MarmoPipe Import tools
% Add the external repositories we need
directory = fullfile(marmoPath, '');
dirs = {'MarmosetScripts', ...
'ephys-matlab', ...
'+csd'};
% remove directories that could not be found
remove = cellfun(@(x) ~exist(fullfile(directory, x), 'dir'), dirs);
if any(remove) % throw warning
removeList = dirs(remove);
dirs(remove) = [];
fprintf('Could not find %d external repositories. \nI''m trusting you to add them.\nListing here:\n', numel(removeList))
for i = 1:numel(removeList)
fprintf('%s\n', removeList{i});
end
end
addPathsWithoutGit(directory, dirs);
% add MarmoPipe and Import
%addPathsWithoutGit(marmoPath, {'Import', 'MarmoPipe'})
if nargout > 0 % if argument is requested, pass out the path to marmoPath
varargout{1} = marmoPath;
end
function addPathsWithoutGit(directory, dirList)
% addPathsWithoutGit is essentially the same as addpath(genpath(dirList)),
% but it ignores the .git hidden folders
for j=1:length(dirList)
a=genpath(fullfile(directory, dirList{j}));
% convert list of paths into a cellarray of subfolders
b=textscan(a,'%s','delimiter',';');
b=b{1};
% remove git hidden folders
b(~cellfun(@isempty,strfind(b,'.git')))=[]; %#ok<STRCLFH>
% add all the paths
addpath(b{:})
fprintf('added [%s] to the path\n', dirList{j});
end
cd('C:\Users\Gabe\Documents\MitchellLab\V1FreeViewingCode')
addpath('Data')
addFreeViewingPaths('gabelaptop')