DMPexcel2mat.m refactor

This commit is contained in:
2024-07-27 01:26:58 -04:00
parent 25a2641548
commit 5dc6021582

View File

@@ -90,8 +90,8 @@ end
% The input files should be csv, not xlsx
% This whole file could be much better and more portable
if ispc
[num, txt, raw] = xlsread(masterPlateFile); %,'Yor1HitsMPsetFinal');
fields= {txt(2,1:15)}; %or 1:17 for later but dont wish to exceed and cause error ? if used
[num, txt, raw]=xlsread(masterPlateFile); %,'Yor1HitsMPsetFinal');
fields={txt(2,1:15)}; %or 1:17 for later but dont wish to exceed and cause error ? if used
else
clear MPtbl
opts=detectImportOptions(masterPlateFile);
@@ -186,7 +186,7 @@ if ~exist(drugMediaFile, 'file') || isempty(drugMediaFile)
disp(strcat('Using matching DrugMedia file: ', drugMediaFile, ', skipping directory selection'));
else
% Try to find the DrugMedia file automatically (newest created first)
files=dir(matDir)
files=dir(matDir);
dmFiles={files(strncmp(files.name, 'DrugMedia_', 10)).name};
if isempty(dmFiles)
throw (MException('MATLAB:dir', 'No DrugMedia_ files in directory'));
@@ -210,7 +210,7 @@ if ~exist(drugMediaFile, 'file') || isempty(drugMediaFile)
questdlg('Select DrugMedia directory','Directory Selection','OK',...
struct('Default','OK','Interpreter','tex'))
dirToScan=uigetdir();
files=dir(dirToScan)
files=dir(dirToScan);
dmFiles={files(strncmp(files.name, 'DrugMedia_', 10)).name};
if isempty(dmFiles)
throw (MException('MATLAB:dir', 'No DrugMedia_ files in directory'));
@@ -220,14 +220,13 @@ if ~exist(drugMediaFile, 'file') || isempty(drugMediaFile)
sortedFiles=dmFiles{sortedIndices};
drugMediaFile=sortedFiles{1};
catch ME
h = msgbox(ME.message, 'Error', 'error');
h=msgbox(ME.message, 'Error', 'error');
uiwait(h);
disp('Rerunning directory selection')
disp('Rerunning directory selection');
% I don't know what else we'll need to do here
end
end
end
end
else
disp(strcat('Using drugMediaFile: ', drugMediaFile, ', skipping directory selection'));
end