Organize old files
This commit is contained in:
@@ -5,87 +5,15 @@ global expType
|
||||
global usrExpJobsDir
|
||||
global zonePB
|
||||
|
||||
% Initialize some variables from matlab
|
||||
ezPath=which(mfilename);
|
||||
[ezDir,ezFileName]=fileparts(ezPath);
|
||||
ezDir=fullfile(easyDir);
|
||||
[parentDir, ~]=fileparts(ezDir);
|
||||
parentDir=fullfile(parentDir); % ../easy/apps
|
||||
|
||||
debug=1;
|
||||
if debug
|
||||
disp('Running in debug mode');
|
||||
disp('Initialized variables:');
|
||||
whos;
|
||||
end
|
||||
|
||||
% Set scansDir (project scans directory) intelligently
|
||||
if exist('PROJECT', 'var') && ~isempty(getenv('PROJECT'))
|
||||
scansDir=getenv('PROJECT');
|
||||
fprintf('Using project path: %s from environment variable PROJECT\n', scansDir);
|
||||
disp('This usually indicates that we are in standalone mode');
|
||||
elseif exist('PROJECT_SCANS_DIR', 'var') && ~isempty(getenv('PROJECT_SCANS_DIR'))
|
||||
scansDir=getenv('PROJECT_SCANS_DIR');
|
||||
fprintf('Using scans directory: %s from environment variable PROJECT_SCANS_DIR\n', scansDir);
|
||||
disp('This usually indicates that we are in module mode');
|
||||
else
|
||||
% TODO Lots of this is hardcoded logic, this TODO is just a reminder to change this block
|
||||
% when changing EASY and other variables in the parent script
|
||||
fprintf('Beginning parent scans directory search\n');
|
||||
fprintf('This usually indicates that we are in stand-alone mode without PROJECT or PROJECT_SCANS_DIR environment variables\n');
|
||||
dirsToScan={
|
||||
fullfile(parentDir,'..', '..', 'scans'),
|
||||
fullfile(parentDir, '..', '..', 'ExpJobs'),
|
||||
fullfile('/mnt/data/scans'),
|
||||
fullfile('/mnt/data/ExpJobs'),
|
||||
fullfile(parentDir, '..', '..', 'templates', 'scans-demo')
|
||||
};
|
||||
for d=dirsToScan
|
||||
if exist(d, 'dir')
|
||||
subDirs=dir(d);
|
||||
if ~isempty(subDirs)
|
||||
fprintf('Found a non-empty parent scans directory in our list: %s\n', d);
|
||||
fprintf('Scanning inside for a project scan directory\n');
|
||||
[~, sortedIndices]=sort(datenum({dirs.date}), 'descend'); % sort by newest first
|
||||
sortedDirs=dirs{sortedIndices};
|
||||
scansDir=sortedDirs{1};
|
||||
fprintf('Selected newest project scans directory: %s\n', scansDir);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% User sanity check and warning
|
||||
if exist('PROJECT_USER', 'var') && ~isempty(getenv('PROJECT_USER'))
|
||||
if ~equal(getenv('PROJECT_USER'), userName)
|
||||
disp("WARNING: PROJECT_USER does not match the current namespace");
|
||||
end
|
||||
end
|
||||
|
||||
% Allow module to override hardcoded default EZview directory
|
||||
if exist('EZVIEW_DIR','var') && ~isempty(getenv('EZVIEW_DIR'))
|
||||
EZVIEW_DIR=fullfile(getenv('EZVIEW_DIR'));
|
||||
if ~strcmp(ezDir, EZVIEW_DIR) % sanity check
|
||||
disp("WARNING: EZVIEW_DIR does not match this script's hardcoded EZview location");
|
||||
disp("This is probably OK but if strange beahvior arises, we'll need to fix it in code");
|
||||
ezDir=EZVIEW_DIR;
|
||||
end
|
||||
fprintf('Using EZview script directory: %s from environment variable EZVIEW_DIR\n', ezDir);
|
||||
else
|
||||
fprintf('Using EZview script directory: %s from hardcoded default\n', ezDir);
|
||||
end
|
||||
|
||||
w=pwd;
|
||||
|
||||
% Single Exp or Chronological Study
|
||||
% Construct a questdlg with three options
|
||||
|
||||
Exp(expN).expLoadCnt= 0;
|
||||
|
||||
Exp(expN).expLoadCnt=0;
|
||||
% Initiation for composite plotting cPlots
|
||||
Exp(expN).cTraceN= 1;
|
||||
Exp(expN).cTraceIndx= 1;
|
||||
Exp(expN).CompositPlot= 0;
|
||||
Exp(expN).cTraceN=1;
|
||||
Exp(expN).cTraceIndx=1;
|
||||
Exp(expN).CompositPlot=0;
|
||||
|
||||
choice='Cancel';
|
||||
expType=0;
|
||||
@@ -192,6 +120,7 @@ if expType==1
|
||||
cd(w)
|
||||
return
|
||||
end
|
||||
|
||||
%Return without execution if user cancels or doesn't select a .mat file
|
||||
try
|
||||
if openExpfile==0 || openExppath==0, cd(w), return, end
|
||||
|
||||
Reference in New Issue
Block a user