Some header work
This commit is contained in:
@@ -30,55 +30,52 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile)
|
||||
% This can be silent, not really an error
|
||||
end
|
||||
|
||||
for i=1:5 % give users 5 chances to get it right
|
||||
try
|
||||
% For standalone mode
|
||||
% GUI input for selecting a MasterPlate Excel file
|
||||
questdlg('Select MasterPlate Directory (containing DrugMedia_ & MasterPlate_ files)','Directory Selection','OK',...
|
||||
struct('Default','OK','Interpreter','tex'))
|
||||
dirToScan=uigetdir();
|
||||
files=dir(dirToScan);
|
||||
mpFiles={files(strncmp(files.name, 'MasterPlate_', 12)).name};
|
||||
if isempty(mpFiles)
|
||||
throw(MException('MATLAB:dir', 'No MasterPlate_ files in directory'))
|
||||
end
|
||||
% this sorts by date (newest first)
|
||||
[~, sortedIndices]=sort(datenum({files(strncmp(mpFiles.name, 'MasterPlate_', 12)).date}), 'descend');
|
||||
sortedFiles=mpFiles{sortedIndices};
|
||||
masterPlateFile=sortedFiles{1};
|
||||
disp('Using newest MasterPlate file: ', masterPlateFile, ', skipping directory selection');
|
||||
break
|
||||
catch ME
|
||||
h=msgbox(ME.message, 'Error', 'error');
|
||||
disp('Rerunning directory selection');
|
||||
% I don't know what else we'll need to do here
|
||||
|
||||
try
|
||||
% For standalone mode
|
||||
% GUI input for selecting a MasterPlate Excel file
|
||||
questdlg('Select MasterPlate Directory (containing DrugMedia_ & MasterPlate_ files)','Directory Selection','OK',...
|
||||
struct('Default','OK','Interpreter','tex'))
|
||||
dirToScan=uigetdir();
|
||||
files=dir(dirToScan);
|
||||
mpFiles={files(strncmp(files.name, 'MasterPlate_', 12)).name};
|
||||
if isempty(mpFiles)
|
||||
throw(MException('MATLAB:dir', 'No MasterPlate_ files in directory'))
|
||||
end
|
||||
% this sorts by date (newest first)
|
||||
[~, sortedIndices]=sort(datenum({files(strncmp(mpFiles.name, 'MasterPlate_', 12)).date}), 'descend');
|
||||
sortedFiles=mpFiles{sortedIndices};
|
||||
masterPlateFile=sortedFiles{1};
|
||||
disp('Using newest MasterPlate file: ', masterPlateFile, ', skipping directory selection');
|
||||
break
|
||||
catch ME
|
||||
h=msgbox(ME.message, 'Error', 'error');
|
||||
disp('Rerunning directory selection');
|
||||
% I don't know what else we'll need to do here
|
||||
end
|
||||
else
|
||||
for i=1:5 % give users 5 chances to get it right
|
||||
try
|
||||
% For standalone mode
|
||||
% GUI input for selecting a MasterPlate Excel file
|
||||
questdlg('Select MasterPlate Directory (containing DrugMedia_ & MasterPlate_ files)','Directory Selection','OK',...
|
||||
struct('Default','OK','Interpreter','tex'))
|
||||
dirToScan=uigetdir();
|
||||
files=dir(dirToScan);
|
||||
mpFiles={files(strncmp(files.name, 'MasterPlate_', 12)).name};
|
||||
if isempty(mpFiles)
|
||||
throw (MException('MATLAB:dir', 'No MasterPlate_ files in directory'));
|
||||
end
|
||||
% this sorts by date (newest first)
|
||||
[~, sortedIndices]=sort(datenum({files(strncmp(mpFiles.name, 'MasterPlate_', 12)).date}), 'descend');
|
||||
sortedFiles=mpFiles{sortedIndices};
|
||||
masterPlateFile=sortedFiles{1};
|
||||
disp('Using newest MasterPlate file: ', masterPlateFile, ', skipping directory selection');
|
||||
break
|
||||
catch ME
|
||||
h=msgbox(ME.message, 'Error', 'error');
|
||||
uiwait(h);
|
||||
disp('Rerunning directory selection');
|
||||
% I don't know what else we'll need to do here
|
||||
try
|
||||
% For standalone mode
|
||||
% GUI input for selecting a MasterPlate Excel file
|
||||
questdlg('Select MasterPlate Directory (containing DrugMedia_ & MasterPlate_ files)','Directory Selection','OK',...
|
||||
struct('Default','OK','Interpreter','tex'))
|
||||
dirToScan=uigetdir();
|
||||
files=dir(dirToScan);
|
||||
mpFiles={files(strncmp(files.name, 'MasterPlate_', 12)).name};
|
||||
if isempty(mpFiles)
|
||||
throw (MException('MATLAB:dir', 'No MasterPlate_ files in directory'));
|
||||
end
|
||||
% this sorts by date (newest first)
|
||||
[~, sortedIndices]=sort(datenum({files(strncmp(mpFiles.name, 'MasterPlate_', 12)).date}), 'descend');
|
||||
sortedFiles=mpFiles{sortedIndices};
|
||||
masterPlateFile=sortedFiles{1};
|
||||
disp('Using newest MasterPlate file: ', masterPlateFile, ', skipping directory selection');
|
||||
break
|
||||
catch ME
|
||||
h=msgbox(ME.message, 'Error', 'error');
|
||||
uiwait(h);
|
||||
disp('Rerunning directory selection');
|
||||
% I don't know what else we'll need to do here
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user