From: Lukáš Jiřiště Date: Tue, 15 Oct 2024 12:33:41 +0000 (+0200) Subject: Log results of main script in a .csv file X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=7c4d08f786df32fdfa46ace2fc60cc9d09ae8e5e;p=Bubble_column.git Log results of main script in a .csv file --- diff --git a/batch_column_processing.m b/batch_column_processing.m index a6b8d64..2aea0bb 100755 --- a/batch_column_processing.m +++ b/batch_column_processing.m @@ -43,11 +43,14 @@ if (mask == 0) end meter = load_meter(); -if (meter == 0) +if (isequal(meter, 0)) path(oldpath); return end +results_dir = get_last_path(); +results_dir = uigetdir(results_dir, "Select directory for results"); + FileType = '*.png'; % process all directories in cycles @@ -66,7 +69,8 @@ for i=1:nSelectedDirectory path(oldpath); return end - main_wb = waitbar(0, 'Whole processing progress'); + close(); + main_wb = waitbar(0, 'Whole batch progress'); end waitbar((i - 0.5)/nSelectedDirectory, main_wb); @@ -88,11 +92,21 @@ for i=1:nSelectedDirectory intensity = mean(double(Figure), Weights = mask); [water(j), bubble_top(j), bubble_bot(j)] = get_levels(intensity); time(j) = name_to_time(ImageName) - start_time; + if (j == 1) + write_mode = 'overwrite'; + else + write_mode = 'append'; + end + writecell(... + [{FFiles(j).name}, {FFiles(j).date}, ... + {water(j)}, {bubble_top(j)}, {bubble_bot(j)}],... + [results_dir '/' SelectedDirectory{i} '.csv'],... + "WriteMode", write_mode); end close(wait_bar); waitbar(i/nSelectedDirectory, main_wb); - figure + figure() plot(seconds(time), 100 * meter([water; bubble_top; bubble_bot]'), 'LineWidth', 3); legend('Water level', 'Bubble top', 'Bubble bottom','Location', 'north'); xlabel('Time (s)');