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);
[parentDir, ~]=fileparts(easyDir);
userName=system('whoami');
now=datetime('now');
todayDateStr=datestr(now, 'yyyymmdd');
todayStr=datetime('now', 'Format', 'yyyyMMdd'); % This should match the parent workflow script
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");
end
% For happiness
if todayDateStr == scansDate
if todayStr == scansDate
disp("Early bird gets the worm");
end
end
@@ -90,7 +89,7 @@ function varargout = EASYconsole(varargin)
easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR'));
disp(strcat('Using project prefix: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR'))
else
easyResultsDirName=strcat('Results_',todayDateStr,'_',easySuffix);
easyResultsDirName=strcat('Results_',todayStr,'_',easySuffix);
easyResultsDir=fullfile(scansDir,easyResultsDirName);
scansDir=fullfile(parent_dir,'ExpJobs') % relative to easy script dir
disp(strcat('Using project prefix: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX'))
@@ -167,7 +166,7 @@ function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
fhconsole=gcf;
% 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)
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir)));
@@ -217,13 +216,13 @@ function NewExpDat_Callback(~, ~, ~)
SWnewExp=1;
inputFileName=strrep(inputFile,'.mat','');
easyResultsDirName=strcat('Results_',todayDateStr,'_',userName,'_',inputFileName);
easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName);
% Set paths
scansDir=fullfile(inputPath);
easyResultsDir=fullfile(scansDir,easyResultsDirName);
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*****
nlist=dir(fullfile(scansDir,'*'));