-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gitignore and setLocalDataPath function
- Loading branch information
1 parent
fe5bd01
commit f4611ea
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
function localDataPath = setLocalDataPath(varargin) | ||
% function LocalDataPath = setLocalDataPath(varargin) | ||
% Return the path to the root CCEP directory and add paths in this repo | ||
% | ||
% input: | ||
% personalDataPath: optional, set to 1 if adding personalDataPath | ||
% | ||
% when adding personalDataPath, the following function should be in the | ||
% root of this repo: | ||
% | ||
% function localDataPath = personalDataPath() | ||
% 'localDataPath = [/my/path/to/data]; | ||
% | ||
% function localDataPath = personalDataPath(1) | ||
% % to load path from personalDataPath | ||
% | ||
% personalDataPath is ignored in .gitignore | ||
% | ||
% dhermes, 2020, Multimodal Neuroimaging Lab | ||
|
||
|
||
if isempty(varargin) | ||
rootPath = which('setLocalDataPath'); | ||
ccepRepoPath = fileparts(rootPath); | ||
|
||
% add path to functions | ||
addpath(genpath(ccepRepoPath)); | ||
|
||
% add localDataPath default | ||
localDataPath = fullfile(ccepRepoPath,'data'); | ||
elseif ~isempty(varargin) | ||
% add path to data | ||
if varargin{1}==1 && exist('personalDataPath','file') | ||
localDataPath = personalDataPath(); | ||
|
||
elseif varargin{1}==1 && ~exist('personalDataPath','file') | ||
sprintf(['add personalDataPath function to add your localDataPath:\n'... | ||
'\n'... | ||
'function localDataPath = personalDataPath()\n'... | ||
'localDataPath.input = [/my/path/to/data];\n'... | ||
'localDataPath.output = [/my/path/to/output];\n'... | ||
'\n'... | ||
'this function is ignored in .gitignore']) | ||
return | ||
end | ||
|
||
% add path to functions | ||
rootPath = which('setLocalDataPath'); | ||
ccepRepoPath = fileparts(rootPath); | ||
addpath(genpath(ccepRepoPath)); | ||
end | ||
|
||
return | ||
|