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

Commit e93cdd7

Browse files
committed
More user-friendly cropping
1 parent 12e00f5 commit e93cdd7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fix_spectra/fix_click_menu.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,10 @@ function fix_click_menu(hObject, eventdata, handles) %#ok<INUSD>
158158
elseif strcmp(str{s},'Crop')
159159
collections = getappdata(gcf,'collections');
160160
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))}));
161+
xminimum = str2double(inputdlg(['Collection ' num2str(c) ': Remove Xs less than?'], 'Crop', 1, {num2str(min(collections{c}.x))}));
162+
xmaximum = str2double(inputdlg(['Collection ' num2str(c) ': Remove Xs greater than?'], 'Crop', 1, {num2str(max(collections{c}.x))}));
163+
if isempty(xminimum); xminimum = min(collections{c}.x); end;
164+
if isempty(xmaximum); xmaximum = max(collections{c}.x); end;
163165
inds = find(round(collections{c}.x * 10000) / 10000 >= xminimum & round(collections{c}.x * 10000) / 10000 <= xmaximum);
164166
collections{c}.x = collections{c}.x(inds);
165167
collections{c}.Y = collections{c}.Y(inds, :);
@@ -423,4 +425,4 @@ function fix_click_menu(hObject, eventdata, handles) %#ok<INUSD>
423425
else
424426
msgbox('This spectrum cannot be normalized because it has 0 area.');
425427
end
426-
end
428+
end

0 commit comments

Comments
 (0)