Work on lab PC

- many new automations
- scripts to record and save MPI and bias optimizations...
This commit is contained in:
Silas Labor Zizou
2024-10-15 08:43:27 +02:00
parent 7cb3f064df
commit bf94e3dc2f
16 changed files with 2548 additions and 104 deletions

45
Functions/updateWaitbar.m Normal file
View File

@@ -0,0 +1,45 @@
function updateWaitbar(currentIteration, totalIterations)
if currentIteration == 1
% Check if the waitbar already exists using its unique Tag
hWaitbar = findobj('Tag', 'MyUniqueWaitbar');
if isempty(hWaitbar) || ~ishandle(hWaitbar)
% Create a waitbar with a unique Tag if it doesn't exist
hWaitbar = waitbar(0, 'Starting process...', 'Name', 'Processing Progress', 'Tag', 'MyUniqueWaitbar');
else
% Waitbar exists, reset the progress bar
waitbar(0, hWaitbar, 'Resuming process...');
end
elseif currentIteration == totalIterations+1
% Check if the waitbar already exists using its unique Tag
hWaitbar = findobj('Tag', 'MyUniqueWaitbar');
% Close the waitbar after the loop is completed
if ishandle(hWaitbar)
close(hWaitbar);
end
else
% Check if the waitbar already exists using its unique Tag
hWaitbar = findobj('Tag', 'MyUniqueWaitbar');
% Calculate the progress fraction
progressFraction = currentIteration / totalIterations;
% Update the waitbar's progress and message
if ishandle(hWaitbar)
waitbar(progressFraction, hWaitbar, ...
sprintf('Progress: %d/%d', currentIteration, totalIterations));
else
% % If the waitbar was closed, recreate it
% hWaitbar = waitbar(progressFraction, 'Resuming process...', 'Name', 'Processing Progress', 'Tag', 'MyUniqueWaitbar');
end
end