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);
-function save_meter(meter, fullpath)
+function save_meter(fullpath, meter)
info = functions(meter);
coefs = info.workspace{1}.coefs;
writematrix(coefs, fullpath, 'FileType', 'text');