Skip to content
This repository was archived by the owner on Aug 14, 2021. It is now read-only.

Commit 12e00f5

Browse files
committed
Added local cropping code
1 parent c2fbf9e commit 12e00f5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

fix_spectra/fix_click_menu.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function fix_click_menu(hObject, eventdata, handles) %#ok<INUSD>
4141
...%'','Set noise regions', ...
4242
'','Load regions','Create signal map','Create new region', ...
4343
'Edit region','Delete region','Clear regions','Fix baseline', ...
44-
'','Set reference','Normalize to reference','Zero regions', 'Sum normalize','Normalize to weight',...
44+
'','Crop','Set reference','Normalize to reference','Zero regions', 'Sum normalize','Normalize to weight',...
4545
'','Save regions','Finalize','Save collections', ...
4646
'Merge processing logs','Merge locally' ...
4747
'Post collections','Save figures','Save images', ...
@@ -155,6 +155,17 @@ function fix_click_menu(hObject, eventdata, handles) %#ok<INUSD>
155155
plot_all;
156156
elseif strcmp(str{s},'Zero regions')
157157
zero_regions;
158+
elseif strcmp(str{s},'Crop')
159+
collections = getappdata(gcf,'collections');
160+
for c = 1:length(collections)
161+
xminimum = str2double(inputdlg(['Collection ' num2str(c) ' - Crop out X values less than:'], 'Crop', 1, {num2str(min(collections{c}.x))}));
162+
xmaximum = str2double(inputdlg(['Collection ' num2str(c) ' - Crop out X values greater than:'], 'Crop', 1, {num2str(max(collections{c}.x))}));
163+
inds = find(round(collections{c}.x * 10000) / 10000 >= xminimum & round(collections{c}.x * 10000) / 10000 <= xmaximum);
164+
collections{c}.x = collections{c}.x(inds);
165+
collections{c}.Y = collections{c}.Y(inds, :);
166+
end
167+
setappdata(gcf,'collections',collections);
168+
plot_all;
158169
elseif strcmp(str{s},'Set reference')
159170
prompt={'Left:','Right:','New position'};
160171
name='Set reference';

0 commit comments

Comments
 (0)