EASYconsole.m: datestr to datetime

This commit is contained in:
2024-07-26 10:59:22 -04:00
parent 90c832fd0a
commit 3ca383e0c8

View File

@@ -20,8 +20,7 @@ function varargout = EASYconsole(varargin)
easyDir=fullfile(easyDir); easyDir=fullfile(easyDir);
[parentDir, ~]=fileparts(easyDir); [parentDir, ~]=fileparts(easyDir);
userName=system('whoami'); userName=system('whoami');
now=datetime('now'); todayStr=datetime('now', 'Format', 'yyyyMMdd'); % This should match the parent workflow script
todayDateStr=datestr(now, 'yyyymmdd');
disp(strcat('This script name: ', easyFileName)) disp(strcat('This script name: ', easyFileName))
@@ -64,7 +63,7 @@ function varargout = EASYconsole(varargin)
disp("This usually means that you are attempting to run an EASY analysis on another user's project data scans"); disp("This usually means that you are attempting to run an EASY analysis on another user's project data scans");
end end
% For happiness % For happiness
if todayDateStr == scansDate if todayStr == scansDate
disp("Early bird gets the worm"); disp("Early bird gets the worm");
end end
end end
@@ -90,7 +89,7 @@ function varargout = EASYconsole(varargin)
easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR')); easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR'));
disp(strcat('Using project prefix: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR')) disp(strcat('Using project prefix: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR'))
else else
easyResultsDirName=strcat('Results_',todayDateStr,'_',easySuffix); easyResultsDirName=strcat('Results_',todayStr,'_',easySuffix);
easyResultsDir=fullfile(scansDir,easyResultsDirName); easyResultsDir=fullfile(scansDir,easyResultsDirName);
scansDir=fullfile(parent_dir,'ExpJobs') % relative to easy script dir scansDir=fullfile(parent_dir,'ExpJobs') % relative to easy script dir
disp(strcat('Using project prefix: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX')) disp(strcat('Using project prefix: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX'))
@@ -167,7 +166,7 @@ function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
fhconsole=gcf; fhconsole=gcf;
% BCR this is set in the global function so I think we're good here % BCR this is set in the global function so I think we're good here
% easyResultsDirName=strcat('Results',todayDateStr,newExpfilePref); % easyResultsDirName=strcat('Results',todayStr,newExpfilePref);
if exist('easyResultsDir','var') && ~isempty(easyResultsDir) if exist('easyResultsDir','var') && ~isempty(easyResultsDir)
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir))); set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir)));
@@ -217,13 +216,13 @@ function NewExpDat_Callback(~, ~, ~)
SWnewExp=1; SWnewExp=1;
inputFileName=strrep(inputFile,'.mat',''); inputFileName=strrep(inputFile,'.mat','');
easyResultsDirName=strcat('Results_',todayDateStr,'_',userName,'_',inputFileName); easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName);
% Set paths % Set paths
scansDir=fullfile(inputPath); scansDir=fullfile(inputPath);
easyResultsDir=fullfile(scansDir,easyResultsDirName); easyResultsDir=fullfile(scansDir,easyResultsDirName);
matDir=fullfile(easyResultsDir,'matResults'); matDir=fullfile(easyResultsDir,'matResults');
matFile=fullfile(matDir,strcat(todayDateStr,'_',userName,'_',inputFile)); matFile=fullfile(matDir,strcat(todayStr,'_',userName,'_',inputFile));
%***Added for 'parfor global' to preallocate 'scan' structure 20-0123***** %***Added for 'parfor global' to preallocate 'scan' structure 20-0123*****
nlist=dir(fullfile(scansDir,'*')); nlist=dir(fullfile(scansDir,'*'));