Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/badges/code_issues.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion code/+nansen/+dataio/@DataSet/DataSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function onIsArchiveSet(obj)
function str = getDatePrefix(obj)

if isempty(obj.DatePrefixStr_)
obj.DatePrefixStr_ = datestr(now, 'yyyymmdd_HH_MM_SS');
obj.DatePrefixStr_ = char(datetime('now'), 'yyyyMMdd_HH_mm_ss');
end

if obj.IsArchive
Expand Down
2 changes: 1 addition & 1 deletion code/+nansen/+internal/reset.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function reset()
fullfile(nansenRootPath, '_userdata', 'settings') };

backupPath = fullfile(nansenRootPath, '_userdata', 'backup', ...
datestr(now, 'yyyy_mm_dd_HHMMSS'));
char(datetime('now'), 'yyyy_MM_dd_HHmmss'));

for i = 1:numel(folderPath)

Expand Down
2 changes: 1 addition & 1 deletion code/+nansen/+manage/+options/OptionsSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
end
end

% = datestr(t, 'yyyy.mm.dd - HH:MM:SS')
% = char(datetime(t, 'ConvertFrom', 'datenum'), 'yyyy.MM.dd - HH:mm:ss')
end
2 changes: 1 addition & 1 deletion code/+nansen/+manage/OptionsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ function refreshCustomOptions(obj)
S.Description = descr;
S.Options = opts;
S.DateCreatedNum = t;
S.DateCreated = datestr(t, 'yyyy.mm.dd - HH:MM:SS');
S.DateCreated = char(datetime(t, 'ConvertFrom', 'datenum'), 'yyyy.MM.dd - HH:mm:ss');
end

function S = getEmptyOptionsSet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function assertPreviewOptionsValid(obj)
namePostfix = strcat(lower(obj.Name), '_preview');
namePostfix = strrep(namePostfix, ' ', '_');

datePrefix = datestr(now, 'yyyymmdd_HH_MM_SS');
datePrefix = char(datetime('now'), 'yyyyMMdd_HH_mm_ss');
folderName = strcat(datePrefix, '_', namePostfix);

if ~isempty(obj.DataIoModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@

sessionIDs = {obj.SessionID};
dateStrings = cellfun(@(sid) sid(7:14), sessionIDs, 'uni', 0);
dateNumbers = datenum(dateStrings, 'yyyymmdd');
dates = datetime(dateStrings, 'InputFormat', 'yyyyMMdd');

[~, sortInd] = sort(dateNumbers);
[~, sortInd] = sort(dates);
obj = obj(sortInd);
end

Expand Down
2 changes: 1 addition & 1 deletion code/apps/+fovmanager/@App/App.m
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ function saveCurrentDisplay(obj)
mouseName = 'fov';
end
fileName = sprintf('%s_%s_%s.png', ...
datestr(now, 'yyyy_mm_dd_HHMMSS'), ...
char(datetime('now'), 'yyyy_MM_dd_HHmmss'), ...
mouseName, ...
'brainMap' );

Expand Down
2 changes: 1 addition & 1 deletion code/apps/+imviewer/@App/App.m
Original file line number Diff line number Diff line change
Expand Up @@ -4150,7 +4150,7 @@ function saveImage(obj, savePath)
end

function saveImageToDesktop(obj)
filename = strcat('imviewer_', datestr(now, 'yyyy_mm_dd-HH.MM.SS'), '.tif');
filename = strcat('imviewer_', char(datetime('now'), 'yyyy_MM_dd-HH.mm.ss'), '.tif');
savePath = fullfile(getDesktop, filename);

obj.saveImage(savePath)
Expand Down
2 changes: 1 addition & 1 deletion code/apps/+mclassifier/manualClassifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ function keyPress(obj, src, event)
case 'p'
if contains(event.Modifier, 'command')
im = frame2im(getframe(obj.hTiledImageAxes.Axes));
filename = strcat( datestr(now, 'yyyy_mm_dd_HHMMSS'), '_printscreen.tif');
filename = strcat( char(datetime('now'), 'yyyy_MM_dd_HHmmss'), '_printscreen.tif');
imwrite(im, fullfile(getDesktop, filename), 'TIFF')
end

Expand Down
16 changes: 8 additions & 8 deletions code/apps/+nansen/@TaskProcessor/TaskProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function loadTaskLists(obj, filePath)
obj.TaskHistory = S.taskListHistory;
catch ME
% Back up file
dateStr = datestr(now, 'yyyymmdd_HH_MM_SS');
dateStr = char(datetime('now'), 'yyyyMMdd_HH_mm_ss');
filePathBackup = strrep(filePath, '.mat', sprintf('corrupted_%s.mat', dateStr));
movefile(filePath, filePathBackup);

Expand Down Expand Up @@ -452,15 +452,15 @@ function onTimerPeriodSet(obj)
function taskItem = updateTaskWhenFinished(obj, taskItem)
%updateTaskWhenFinished Update task item from the running task obj

date2str = @(dt) datestr(dt, 'yyyy.mm.dd HH:MM:SS');
date2str = @(dt) char(dt, 'yyyy.MM.dd HH:mm:ss');
finishDateStr = date2str(obj.runningTask.FinishDateTime);

elapsedDuration = obj.runningTask.FinishDateTime - obj.runningTask.StartDateTime;

% Update table status
taskItem.timeStarted = obj.runningTask.StartDateTime;
taskItem.timeFinished = finishDateStr;
taskItem.elapsedTime = datestr(elapsedDuration, 'HH:MM:SS');
taskItem.elapsedTime = char(elapsedDuration, 'hh:mm:ss');

% Add diary and error stack
taskItem.Diary = obj.runningTask.Diary;
Expand Down Expand Up @@ -650,11 +650,11 @@ function addCommandWindowTaskToHistory(obj, taskItem)
% Todo: Streamline a bit more, and combine with similar parts
% from updateTaskWhenFinished.

date2str = @(dt) datestr(dt, 'yyyy.mm.dd HH:MM:SS');
taskItem.timeFinished = date2str(now);
date2str = @(dt) char(dt, 'yyyy.MM.dd HH:mm:ss');
taskItem.timeFinished = date2str(datetime('now'));

elapsedDuration = datetime(now, 'ConvertFrom', 'datenum') - taskItem.timeStarted;
taskItem.elapsedTime = datestr(elapsedDuration, 'HH:MM:SS');
elapsedDuration = datetime('now') - taskItem.timeStarted;
taskItem.elapsedTime = char(elapsedDuration, 'hh:mm:ss');

obj.addTaskToHistory(taskItem)
end
Expand Down Expand Up @@ -730,7 +730,7 @@ function removeTask(obj, taskIdx, tableType)
newTask.status = 'Uninitialized';
newTask.numOut = numOut;
newTask.args = args;
newTask.timeCreated = datestr(now, 'yyyy.mm.dd HH:MM:SS');
newTask.timeCreated = char(datetime('now'), 'yyyy.MM.dd HH:mm:ss');
newTask.timeStarted = '';
newTask.elapsedTime = '';
newTask.timeFinished = '';
Expand Down
11 changes: 7 additions & 4 deletions code/datatypes/+nansen/+stack/+metadata/StackMetadata.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ function uiset(obj, src, evt)

function S = toStruct(obj)
S = toStruct@nansen.dataio.metadata.AbstractMetadata(obj);
datestrFormat = 'YYYY_MM_DD_HH_MM_SS_sss';
S.StartTime = datestr(S.StartTime, datestrFormat);
% datetime format spec (case-sensitive: MM=month, mm=minute,
% SSS=millisecond). The previous datestr format
% 'YYYY_MM_DD_HH_MM_SS_sss' was rejected by datestr itself.
dateFormat = 'yyyy_MM_dd_HH_mm_ss_SSS';
S.StartTime = char(S.StartTime, dateFormat);
end

function fromStruct(obj, S, propertyNames)
Expand All @@ -187,8 +190,8 @@ function fromStruct(obj, S, propertyNames)
if ~isfield(S, 'StartTime') || isempty(S.StartTime)
S.StartTime = datetime.empty;
else
datestrFormat = 'YYYY_MM_DD_HH_MM_SS_sss';
S.StartTime = datetime(S.StartTime, 'InputFormat', datestrFormat);
dateFormat = 'yyyy_MM_dd_HH_mm_ss_SSS';
S.StartTime = datetime(S.StartTime, 'InputFormat', dateFormat);
end

if isfield(S, 'Size') && isa(S.Size, 'cell')
Expand Down
4 changes: 2 additions & 2 deletions code/datatypes/+nansen/+stack/ImageStackProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ function appendResults(obj, iResults)

function printSubTask(obj, varargin)
msg = sprintf(varargin{:});
nowstr = datestr(now, 'HH:MM:ss');
nowstr = char(datetime('now'), 'HH:mm:ss');
fprintf('%s: %s: %s\n', nowstr, obj.MethodName, msg)
end

Expand Down Expand Up @@ -1207,7 +1207,7 @@ function displayImageStackSplittingInfo(obj)
methods (Static)
function printTask(varargin) % Todo: move to datamethod
msg = sprintf(varargin{:});
nowstr = datestr(now, 'HH:MM:ss');
nowstr = char(datetime('now'), 'HH:mm:ss');
fprintf('%s: %s\n', nowstr, msg)
end
end
Expand Down