strcat to sprintf
This commit is contained in:
@@ -30,28 +30,37 @@ function varargout = EASYconsole(varargin)
|
||||
userName=system('whoami');
|
||||
todayStr=datetime('now', 'Format', 'yyyyMMdd'); % This should match the parent workflow script
|
||||
|
||||
disp(strcat('This script name: ', easyFileName))
|
||||
disp(sprintf('This script name: %s\n', easyFileName))
|
||||
|
||||
% Set scansDir intelligently (project scans directory)
|
||||
% Allow users to specify a PROJECT=/mnt/data/ExpJobs/Job directory to analyze with EASY
|
||||
% This better enables running the new EASY in standalone mode
|
||||
if exist('PROJECT', 'var') && ~isempty(getenv('PROJECT'))
|
||||
scansDir=get_env('PROJECT');
|
||||
disp(strcat('Using project path: ', scansDir, ' from environment variable PROJECT'));
|
||||
scansDir=getenv('PROJECT')
|
||||
disp(sprintf('Using project path: %s from environment variable PROJECT\n', scansDir));
|
||||
disp('This usually indicates that we are in standalone mode');
|
||||
elseif exist('SCANS_DIR', 'var') && ~isempty(getenv('SCANS_DIR'))
|
||||
scansDir=get_env('SCANS_DIR');
|
||||
disp(strcat('Using scans directory: ', scansDir, ' from environment variable SCANS_DIR'));
|
||||
scansDir=getenv('SCANS_DIR');
|
||||
disp(sprintf('Using scans directory: %s from environment variable SCANS_DIR\n', scansDir));
|
||||
disp('This usually indicates that we are in module mode');
|
||||
else
|
||||
dirToScan=fullfile(parentDir,'ExpJobs'); % hardcoded relative to easy script dir TODO: if we change pj layout this will change
|
||||
dirs=dir(fullfile(dirToScan, 'dir')); % filter for dirs only
|
||||
[~, sortedIndices] = sort(datenum({dirs.date}), 'descend'); % sort by newest first
|
||||
sortedDirs=dirs{sortedIndices};
|
||||
scansDir=sortedDirs{1};
|
||||
disp('Beginning in newest project scans directory');
|
||||
disp(strcat('Using scans directory: ', scansDir, ' from hardcoded default'));
|
||||
disp('This usually indicates that we are in stand-alone mode without PROJECT or SCANS_DIR environment variables');
|
||||
dirToScan = fullfile(parentDir,'ExpJobs'); % hardcoded relative to easy script dir TODO: if we change pj layout this will change
|
||||
if exist(dirToScan, 'dir')
|
||||
dirs=dir(fullfile(dirToScan, 'dir')); % filter for dirs only
|
||||
[~, sortedIndices]=sort(datenum({dirs.date}), 'descend'); % sort by newest first
|
||||
sortedDirs=dirs{sortedIndices};
|
||||
scansDir=sortedDirs{1};
|
||||
disp('Beginning in newest project scans directory');
|
||||
disp(sprintf('Using scans directory: %s from hardcoded relative path\n', scansDir));
|
||||
disp('This usually indicates that we are in stand-alone mode without PROJECT or SCANS_DIR environment variables');
|
||||
else
|
||||
scansDir=fullfile('/mnt/data/ExpJobs/demo')
|
||||
if exist(scansDir, 'dir')
|
||||
disp(sprintf('Using scans directory: %s from hardcoded absolute path to demo\n', scansDir));
|
||||
else
|
||||
disp(sprintf('Error: scansDir %s does not exist\n', scansDir));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% If we don't have the EASY_SUFFIX from the module, generate it from scansDir
|
||||
@@ -67,7 +76,7 @@ function varargout = EASYconsole(varargin)
|
||||
oldSuffix=easySuffix;
|
||||
while exist(easySuffix, 'dir')
|
||||
count=1;
|
||||
easySuffix=strcat(oldSuffix,'.', num2str(count));
|
||||
easySuffix=strcat(oldSuffix,'.',num2str(count));
|
||||
end
|
||||
end
|
||||
% Might as well check this too
|
||||
@@ -89,9 +98,9 @@ function varargout = EASYconsole(varargin)
|
||||
disp("This is probably OK but if strange beahvior arises, we'll need to fix it in code");
|
||||
easyDir=EASY_DIR;
|
||||
end
|
||||
disp(strcat('Using EASY script directory: ', easyDir, ' from environment variable EASY_DIR'));
|
||||
disp(sprintf('Using EASY script directory: %s from environment variable EASY_DIR\n', easyDir));
|
||||
else
|
||||
disp(strcat('Using EASY script directory: ', easyDir, ' from hardcoded default'));
|
||||
disp(sprintf('Using EASY script directory: %s from hardcoded default\n', easyDir));
|
||||
end
|
||||
|
||||
if exist('PROJECT_USER', 'var') && ~isempty(getenv('PROJECT_USER'))
|
||||
@@ -102,23 +111,22 @@ function varargout = EASYconsole(varargin)
|
||||
|
||||
if exist('EASY_RESULTS_DIR', 'var') && ~isempty(getenv('EASY_RESULTS_DIR'))
|
||||
easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR'));
|
||||
disp(strcat('Using output directory: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR'))
|
||||
disp(sprintf('Using output directory: %s from environment variable EASY_RESULTS_DIR\n', easyResultsDir))
|
||||
else
|
||||
easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',easySuffix);
|
||||
easyResultsDir=fullfile(scansDir,easyResultsDirName);
|
||||
|
||||
disp(strcat('Using output directory: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX'))
|
||||
disp(sprintf('Using output directory: %s\n', PROJECT_PREFIX))
|
||||
end
|
||||
|
||||
if exist('MASTER_PLATE_FILE', 'var') && ~isempty(getenv('MASTER_PLATE_FILE'))
|
||||
masterPlateFile=fullfile(get_env('MASTER_PLATE_FILE'));
|
||||
disp(strcat('Using drug media file: ', masterPlateFile, ' from environment variable MASTER_PLATE_FILE'))
|
||||
disp(sprintf('Using drug media file: %s from environment variable MASTER_PLATE_FILE\n', masterPlateFile))
|
||||
else
|
||||
% Try to find MasterPlate_ file on our own
|
||||
mp=fullfile(scansDir,'MasterPlateFiles',strcat('MasterPlate_', easySuffix,'.xlsx'));
|
||||
if exist(mp, 'file')
|
||||
masterPlateFile=mp;
|
||||
disp(strcat('Using drug media file: ', masterPlateFile, ' from internal logic'))
|
||||
disp(sprintf('Using drug media file: %s from internal logic\n', masterPlateFile))
|
||||
else
|
||||
disp("WARNING: Have you created a MasterPlate_ file?")
|
||||
end
|
||||
@@ -126,13 +134,13 @@ function varargout = EASYconsole(varargin)
|
||||
|
||||
if exist('DRUG_MEDIA_FILE', 'var') && ~isempty(getenv('DRUG_MEDIA_FILE'))
|
||||
drugMediaFile=fullfile(get_env('DRUG_MEDIA_FILE'));
|
||||
disp(strcat('Using drug media file: ', drugMediaFile, ' from environment variable DRUG_MEDIA_FILE'))
|
||||
disp(sprintf('Using drug media file: %s from environment variable DRUG_MEDIA_FILE\n', drugMediaFile))
|
||||
else
|
||||
% Try to find MasterPlate_ file on our own
|
||||
dm=fullfile(scansDir,'MasterPlateFiles',strcat('DrugMedia_', easySuffix,'.xlsx'));
|
||||
if exist(mp, 'file')
|
||||
drugMediaFile=dm;
|
||||
disp(strcat('Using drug media file: ', drugMediaFile, ' from internal logic'))
|
||||
disp(sprintf('Using drug media file: %s from internal logic\n', drugMediaFile))
|
||||
else
|
||||
disp("WARNING: Have you created a DrugMedia_ file?")
|
||||
end
|
||||
@@ -167,7 +175,7 @@ function varargout = EASYconsole(varargin)
|
||||
% Pulled this out of the opening function
|
||||
% Seems better to wait until we have our ars set
|
||||
if exist('scansDir','var') && ~isempty(scansDir)
|
||||
set(fhconsole,'Name',strcat('EASYconsole - ',char(scansDir)));
|
||||
set(fhconsole,'Name',sprintf('EASYconsole - %s', scansDir));
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole - No Active Experiment.')
|
||||
end
|
||||
@@ -311,14 +319,14 @@ function NewExpDat_Callback(~, ~, ~)
|
||||
sbdg= cell(1,scanMax);
|
||||
save((fullfile(easyResultsDir,'Fotos','Nbdg')),'sbdg');
|
||||
catch ME
|
||||
disp(strcat('ERROR: ', ME.message))
|
||||
disp(sprintf('ERROR: %s\n', ME.message));
|
||||
end
|
||||
|
||||
% set the title for fhconsole depending on existence
|
||||
if exist('easyResultsDir','var')&&~isempty(easyResultsDir)
|
||||
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir)))
|
||||
set(fhconsole,'Name',sprintf('EASYconsole - %s', easyResultsDir));
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
||||
set(fhconsole,'Name','EASYconsole - Master Plate directory not selected.');
|
||||
end
|
||||
end
|
||||
|
||||
@@ -385,9 +393,9 @@ function LoadDatFile_Callback(~, ~, ~)
|
||||
|
||||
if exist('easyResultsDir','var') && ~isempty(easyResultsDir)
|
||||
fhconsole=gcf;
|
||||
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir)))
|
||||
set(fhconsole,'Name',sprintf('EASYconsole - %s', easyResultsDir));
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.');
|
||||
end
|
||||
end
|
||||
|
||||
@@ -447,7 +455,7 @@ function runResults_DBcombo_Callback(~, ~, ~)
|
||||
DgenResults %similar but semicolons removed to restore so cmdLine display info.
|
||||
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
|
||||
catch ME
|
||||
disp(strcat('Error in DgenResults240430: ', ME.message))
|
||||
disp(sprintf('Error in DgenResults: %s\n', ME.message));
|
||||
EASYconsole
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user