@@ -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 ;
156156elseif 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 ;
158169elseif strcmp(str{s },' Set reference' )
159170 prompt= {' Left:' ,' Right:' ,' New position' };
160171 name= ' Set reference' ;
0 commit comments