From dd0c340490b354f33b51bfe4c42462a77acf6586 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Tue, 15 Oct 2024 14:32:14 +0200 Subject: [PATCH] Fix major mistakes inside create_ and save_meter I must have not tested it before committing before? --- create_meter.m | 14 ++++++++------ functions/save_meter.m | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/create_meter.m b/create_meter.m index fef8f24..daa3fba 100644 --- a/create_meter.m +++ b/create_meter.m @@ -1,21 +1,23 @@ clear all oldpath = addpath('./functions'); +FileType = '*.png'; + last_path = get_last_path(); -[filenames, path] = uigetfile([last_path '/*.mtr'], ... +[filenames, last_path] = uigetfile([last_path '/' FileType], ... 'Select all files for meter creation', 'MultiSelect', 'on'); -update_last_path(path); +update_last_path(last_path); mask = load_mask(); files = struct('name', cell(1, numel(filenames)), 'folder', cell(1,... -numel(filenames))); + numel(filenames))); [files.name] = deal(filenames{:}); -[files.folder] = deal(path); +[files.folder] = deal(last_path); [minfig, maxfig, meanfig] = get_aggregate_images(files); meter = get_meter(maxfig, mask); figure(); imshow(meanfig); -[meter_file_name, meter_path] = uiputfile([path '/*.mtr'], 'Save you mask as...'); -if (mask_file_name ~= 0) +[meter_file_name, meter_path] = uiputfile([path '/*.mtr'], 'Save your meter as...'); +if (meter_file_name ~= 0) save_meter([meter_path '/' meter_file_name], meter) end path(oldpath); diff --git a/functions/save_meter.m b/functions/save_meter.m index fb649b0..c86411b 100644 --- a/functions/save_meter.m +++ b/functions/save_meter.m @@ -1,4 +1,4 @@ -function save_meter(meter, fullpath) +function save_meter(fullpath, meter) info = functions(meter); coefs = info.workspace{1}.coefs; writematrix(coefs, fullpath, 'FileType', 'text'); -- 2.30.2