% browseABSSburst - browse ABSS burst file data by burst % % browseABSSburst('file',filename) opens the file given by filename for browsing % % Written by Marinna Martini for the U.S. Geological Survey % Coastal & Marine Program Woods Hole Field Center, Woods Hole, MA % http://woodshole.er.usgs.gov/ Please report bugs to mmartini@usgs.gov % Last Modified by GUIDE v2.5 11-Jul-2008 10:43:35 function varargout = browseABSSburst(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 0; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @browseABSSburst_OpeningFcn, ... 'gui_OutputFcn', @browseABSSburst_OutputFcn, ... 'gui_LayoutFcn', [], ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before browseABSSburst is made visible. function browseABSSburst_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to browseABSSburst (see VARARGIN) % Choose default command line output for browseABSSburst handles.output = hObject; % figure1: 1.000034179687500e+002 % sliderColorMin: 1.060206298828125e+002 % axes1: 1.010040283203125e+002 % output: 1.000034179687500e+002 % slider 1 controls time shift % slider 2 controls which burst % slider 3 controls which profiles % look for a filename in the varargin handles.mydata.burstfile = []; for i = 1:length(varargin), if strcmp(varargin{i},'file'), handles.mydata.burstfile = varargin{i+1}; end end if isempty(handles.mydata.burstfile), [filename, pathname] = uigetfile('*.*','Open a netCDF file containing burst ABSS data'); if ~filename, return; end handles.mydata.burstfile = fullfile(pathname, filename); end % open the netCDF file and do the basic checks cdf = netcdf(handles.mydata.burstfile); % for passing to other methods handles.mydata.cdf = cdf; set(handles.figure1,'UserData',cdf); % store the netCDF file pointer here so I can close it later set(handles.figure1,'DeleteFcn','if ~isempty(get(gcf,''UserData'')), close(get(gcf,''UserData'')); end'); % and this is the code that will close it if isempty(cdf), disp(['Unable to open netCDF file ',handles.mydata.burstfile]); return; end dimnames = ncnames(dim(cdf)); flag = 0; for i=1:length(dimnames), % make sure this is a burst data file if strcmp(dimnames{i},'sample') || strcmp(dimnames{i},'profile'), flag = 1; end end if ~flag, close(cdf); return; end % the depth dimension handles.mydata.ncells = length(cdf('depth')); if isempty(handles.mydata.ncells) || (handles.mydata.ncells < 1), handles.mydata.ncells = length(cdf('bin')); end if isempty(handles.mydata.ncells) || (handles.mydata.ncells < 1), handles.mydata.ncells = length(cdf('cell')); end for n=1:handles.mydata.ncells, handles.mydata.lstrings{n} = sprintf('%d',n); end % the time dimension (the burst start) handles.mydata.nbursts = length(cdf('burst')); if isempty(handles.mydata.nbursts) || (handles.mydata.nbursts < 1), handles.mydata.nbursts = length(cdf('time')); end % the sub-time dimension (samples in a burst) handles.mydata.nsamples = length(cdf('profile')); if isempty(handles.mydata.nsamples) || (handles.mydata.nsamples < 1), handles.mydata.nbursts = length(cdf('samples')); end set(handles.text7,'string',sprintf('Now browsing file %s',handles.mydata.burstfile)) n=1; varnames = ncnames(var(cdf)); for i=1:length(varnames), % remove burstnum and time if strcmp(varnames{i},'burst') || strcmp(varnames{i},'profile') || ... strcmp(varnames{i},'depth') || strcmp(varnames{i},'lat') || strcmp(varnames{i},'lon') ||... strcmp(varnames{i},'time') || strcmp(varnames{i},'time2') || strcmp(varnames{i},'burstNum') ||... strcmp(varnames{i},'vrange'), % do nothing else handles.mydata.varnames{n} = varnames{i}; n=n+1; end end handles.mydata.vartoplot = handles.mydata.varnames{1}; handles.mydata.newvar = 1; handles.mydata.iburst = 1; handles.mydata.icell = 1; % cell = bin handles.mydata.nsamplesinview = handles.mydata.nsamples; handles.mydata.samples = [1 handles.mydata.nsamples]; handles.mydata.cells = [1 handles.mydata.ncells]; if handles.mydata.nsamples < 500, handles.mydata.minsamplesinview = 1; else handles.mydata.minsamplesinview = 500; end disp('Loading the burst numbers, one moment...') handles.mydata.burstNum = cdf{'burst'}(:); % need these for a lookup table % slider 1 - min color axis handles.mydata.ccmin = 1e-35; handles.mydata.ccmax = 0.0001; set(handles.text1,'string',sprintf('%g',handles.mydata.ccmin)); set(handles.text4,'string',sprintf('%g',handles.mydata.ccmax)); % slider 1 limits -- maybe change the view zoom for the number of samples set(handles.sliderColorMin,'Value',handles.mydata.ccmin,'Min',handles.mydata.ccmin,... 'Max',handles.mydata.ccmax,'SliderStep',[0.01 0.1]); set(handles.sliderColorMin,'Tooltipstring','Set the minimum of the color axis') % slider 3 - max color limit range selector - labels set(handles.text13,'string',sprintf('%g',handles.mydata.ccmin)); set(handles.text12,'string',sprintf('%g',handles.mydata.ccmax)); set(handles.sliderColorMax,'Value',handles.mydata.ccmin,'Min',handles.mydata.ccmin,... 'Max',handles.mydata.ccmax,'SliderStep',[0.01 0.1]); set(handles.sliderColorMax,'Tooltipstring','Select the maximum of the color axis') % slider 2 - burst selector - labels set(handles.text2,'string',sprintf('%d',handles.mydata.burstNum(1))); set(handles.text6,'string',sprintf('%d bursts',handles.mydata.burstNum(end))); % slider 2 limits (burstnumber in view) set(handles.slider2,'Value',handles.mydata.burstNum(1),'Min',handles.mydata.burstNum(1),... 'Max',handles.mydata.burstNum(handles.mydata.nbursts),... 'SliderStep',[1/handles.mydata.nbursts 100/handles.mydata.nbursts]) set(handles.slider2,'Tooltipstring','Select burst number to display') % put varnames into listbox here set(handles.listbox1,'string',handles.mydata.varnames,'Value',1); set(handles.listbox1,'Tooltipstring','Select data to display') % put colormap names into listbox here handles.mydata.colormaps = {'default','jet','HSV','hot','cool','spring','summer','autumn',... 'winter','gray','bone','copper','pink','lines'}; handles.mydata.ccolormap = 'default'; % current color map set(handles.listboxColorMap,'string',handles.mydata.colormaps,'Value',1); set(handles.listboxColorMap,'Tooltipstring','Select colormap') % set the goto box to the first burst set(handles.edit1,'String',sprintf('%d',handles.mydata.burstNum(handles.mydata.iburst))); set(handles.edit1,'Tooltipstring','enter a burst number to jump to') % set contents of first and last bin set(handles.editFirstBin,'String',sprintf('%d',handles.mydata.cells(1))); set(handles.editFirstBin,'Tooltipstring','enter the first cell to plot') set(handles.editLastBin,'String',sprintf('%d',handles.mydata.cells(2))); set(handles.editLastBin,'Tooltipstring','enter the last cell to plot') % other info set(handles.text_stats,'string',' '); % Update handles structure guidata(hObject, handles); % This sets up the initial plot - only do when we are invisible % so window can get raised using example. if strcmp(get(hObject,'Visible'),'off') updateplot(hObject, handles) end % UIWAIT makes browseABSSburst wait for user response (see UIRESUME) % uiwait(handles.figure1); %% ------------------ updates the plot - this is a user function function updateplot(hObject, handles) cdf = handles.mydata.cdf; vartoplot = handles.mydata.vartoplot; % this will be the selection samples = handles.mydata.samples(1):handles.mydata.samples(2); cells = handles.mydata.cells(1):handles.mydata.cells(2); ranges = cells.*cdf.AbsBinLengthMM(1)./10; % in cm %disp(sprintf('updateplot: iburst = %d',handles.mydata.iburst)) %cburst = handles.mydata.burstNum(handles.mydata.iburst); axes(handles.axes1); cla; %data = nc{vartoplot}(handles.mydata.iburst,:,:); % time, freq, dir data = cdf{vartoplot}(handles.mydata.iburst,:,... handles.mydata.cells(1):handles.mydata.cells(2)); % make it intensity data = data.^2; set(handles.textDataLims,'string',sprintf('Data values range from %6.3f to %6.3f',... gmin(gmin(data)'),gmax(gmax(data)'))); tj = cdf{'time'}(handles.mydata.iburst)+cdf{'time2'}(handles.mydata.iburst)./(24*3600*1000); set(handles.textTimeStamp,'string',datestr(datenum(gregorian(tj)))); if handles.mydata.newvar, dmin = gmin(gmin(10.*log10(data))'); dmax = gmax(gmax(10.*log10(data))'); dmed = gmedian(gmedian(10.*log10(data))'); dmean = gmean(gmean(10.*log10(data))'); dstd = gstd(gstd(10.*log10(data))'); sstep = (dmax-dmin)/10000; lstep = (dmax-dmin)/1000; smin = dmin; smax = dmed+dstd; set(handles.textDataLims,'string',sprintf('Data values range from %7g to %7g', dmin,dmax)); % reset the slider for the data for new variable limits set(handles.text1,'string',sprintf('%7g',smin)); set(handles.text4,'string',sprintf('%7g',smax)); set(handles.sliderColorMin,'Value',smin,'Min',smin,... 'Max',smax,'SliderStep',[0.01 0.1]); %[0.0001 0.001]); set(handles.text13,'string',sprintf('%7g',smin)); set(handles.text12,'string',sprintf('%7g',smax)); set(handles.sliderColorMax,'Value',smax,'Min',smin,... 'Max',smax,'SliderStep',[0.01 0.1]); %,[0.0001 0.001]); set(handles.editColorMinValue,'string',sprintf('%7g',smin)); set(handles.editColorMaxValue,'string',sprintf('%7g',smax)); handles.mydata.ccmin = smin; handles.mydata.ccmax = smax; %clims = [smin smax]; end if isnan(handles.mydata.ccmin) || isnan(handles.mydata.ccmax), clims = [handles.mydata.cmin handles.mydata.cmax]; disp('NaNs in color limits') elseif handles.mydata.ccmin > handles.mydata.ccmax, disp('min color limit greater than max') else clims = [handles.mydata.ccmin handles.mydata.ccmax]; end if strcmpi(vartoplot,'abs_trans'), % do some calculations a.la. Ken Foote % data is shaped [samples, cells], and only the data visible in window % is loaded xi = sum(data,2); % sum along profiles %s1 = sum(xi); %s2 = sum(xi.^2); %n = length(samples); %sav = s1/n; %ssd = sqrt((s2-n*sav^2)/(n-1)); ximean = gmean(xi); xistd = gstd(xi); set(handles.text_stats,'string',... sprintf('mean = %10.6f dB; std = %10.6f dB',10.*log10(ximean),10.*log10(xistd))); % fprintf('%s %s burst %d bins %d to %d sav = %10.6f; ssd = % %10.6f\n',... % get(handles.textTimeStamp,'string'),cdf{vartoplot}.frequency(:),... % handles.mydata.iburst,... % handles.mydata.cells(1),handles.mydata.cells(2),sav,ssd) end %disp(sprintf('clims are now %g %g',clims)) %imagesc(samples,cells,10.*log10(data)',clims) imagesc(samples,ranges,10.*log10(data)') colormap(handles.mydata.ccolormap); cbar=colorbar; % set(get(cbar,'Ylabel'),'String',sprintf('%s for %s transducer', ... % cdf{vartoplot}.units(:), cdf{vartoplot}.frequency(:))) set(get(cbar,'Ylabel'),'String',sprintf('%s transducer, dB', cdf{vartoplot}.frequency(:))) xlabel('profile') %ylabel('cell number') ylabel('range from transducer, cm') % ylabel(sprintf('cell #, from %5.2f to %5.2f cmab',... % cdf{'depth'}([handles.mydata.cells(1) handles.mydata.cells(2)]))) %plot(samples(1):samples(2),data); %ylabel(cdf{vartoplot}.units(:)); %text(0.05,0.05,sprintf('%s at %s, burst #%d, samples #%d to %d',cdf{vartoplot}.long_name(:),... % datestr(tm1), cburst, samples(1), samples(2)),'units','normalized'); %if handles.mydata.isABSS, % if ~isvector(data), legend(handles.mydata.lstrings,'Location','EastOutside'); end %end handles.mydata.newvar = 0; % Update handles structure guidata(hObject, handles); % --- Outputs from this function are returned to the command line. function varargout = browseABSSburst_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure % --- Executes during object creation, after setting all properties. function sliderColorMin_CreateFcn(hObject, eventdata, handles) % hObject handle to sliderColorMin (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background, change % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % The actual step size is a function of the specified SliderStep and the % total slider range (Max - Min). The default, [0.01 0.10], provides % a 1 percent change for clicks on the arrow button and a 10 percent % change for clicks in the trough. % --- Executes on slider movement. function sliderColorMin_Callback(hObject, eventdata, handles) % hObject handle to sliderColorMin (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider newvalue = get(hObject,'Value'); if newvalue < handles.mydata.ccmax, handles.mydata.ccmin = newvalue; else end set(handles.editColorMinValue,'string',sprintf('%g',handles.mydata.ccmin)); % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function slider2_CreateFcn(hObject, eventdata, handles) % hObject handle to slider2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background, change % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function slider2_Callback(hObject, eventdata, handles) % hObject handle to slider2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider cburst = round(get(hObject,'Value')); handles.mydata.iburst = find(handles.mydata.burstNum == cburst); if isempty(handles.mydata.iburst), disp('selected burst number not found, using the next in sequence') handles.mydata.iburst = find(handles.mydata.burstNum > cburst,1,'first'); end %disp(sprintf('slider2: cburst = %d; iburst = %d',cburst,handles.mydata.iburst)) set(handles.edit1,'String',sprintf('%d',cburst)); % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function sliderColorMax_CreateFcn(hObject, eventdata, handles) % hObject handle to sliderColorMax (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background, change % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function sliderColorMax_Callback(hObject, eventdata, handles) % hObject handle to sliderColorMax (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider newvalue = get(hObject,'Value'); if newvalue > handles.mydata.ccmin, handles.mydata.ccmax = newvalue; else disp(sprintf('%7g new max value <= %7g color minimum',... newvalue,handles.mydata.ccmin)) end set(handles.editColorMaxValue,'string',sprintf('%7g',handles.mydata.ccmax)); % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function listbox1_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: listbox controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on selection change in listbox1. function listbox1_Callback(hObject, eventdata, handles) % hObject handle to listbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns listbox1 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox1 list = get(hObject,'String'); handles.mydata.vartoplot = list{get(hObject,'Value')}; handles.mydata.newvar = 1; % tell update plot that we have switched.. new data loading guidata(hObject, handles); updateplot(hObject, handles); function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double cburst = str2double(get(hObject,'String')); cburst = round(cburst); % just in case the user doesn't enter an integer handles.mydata.iburst = find(handles.mydata.burstNum == cburst); % should be one value... if isempty(handles.mydata.iburst), % figure out if we are too high or too low if handles.mydata.iburst < handles.mydata.burstNum(1), handles.mydata.iburst = 1; disp('selected burst number is less than the smallest burst number in the file,') disp('using the smallest...') elseif handles.mydata.iburst > handles.mydata.nbursts; handles.mydata.iburst = handles.mydata.burstNum(end); disp('selected burst number is greater than the greatest burst number in the file,') disp('using the largest...') else disp('selected burst number not found, using the next in sequence') handles.mydata.iburst = find(handles.mydata.burstNum > cburst,1,'first'); end elseif length(handles.mydata.iburst) > 1, disp('There are repetetive burst numbers in this cdf file!') disp('using the smallest...') handles.mydata.iburst = min(handles.mydata.iburst); end set(handles.slider2,'Value',cburst); % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on button press in export_button. function export_button_Callback(hObject, eventdata, handles) % hObject handle to export_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % % create a netCDF file with just the burst cburst = handles.mydata.burstNum(handles.mydata.iburst); [pname, fname] = fileparts(name(handles.mydata.cdf)); newname = fullfile(pname,[fname '_' num2str(cburst) '.cdf']); if exist(newname,'file'), button = questdlg(sprintf('Do you want to overwrite %s?', newname),... 'Wanring!','No'); if strcmp(button,'No') | strcmp(button, 'Cancel'), return end end % create the file cdfe = netcdf(newname,'clobber'); % let the user add a comment answer = inputdlg('Enter a comment about this burst','Add metadata',1,{''}); cdfe.forensic_comment = answer{1}; % copy the global objects ncobj = att(handles.mydata.cdf); for n = 1:length(ncobj), copy(ncobj{n},cdfe); end % set up the dimensions ncobj = dim(handles.mydata.cdf); rdim = recdim(handles.mydata.cdf); for n = 1:length(ncobj), if strcmp(name(rdim),name(ncobj{n})), cdfe(name(rdim)) = 0; % make the record dimension else copy(ncobj{n},cdfe); end end % make empty variables ncobj = var(handles.mydata.cdf); for n = 1:length(ncobj), copy(ncobj{n},cdfe,0,1); % copy atts only end % populate variables with data ncobje = var(cdfe); for n = 1:length(ncobj), ncobje{n}(1,:,:) = ncobj{n}(handles.mydata.iburst,:,:); end % (handles.mydata.iburst,:,:) disp(sprintf('Burst %d copied to %s',cburst,newname)) close(cdfe) % --- Executes on selection change in listboxColorMap. function listboxColorMap_Callback(hObject, eventdata, handles) % hObject handle to listboxColorMap (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns listboxColorMap contents as cell array % contents{get(hObject,'Value')} returns selected item from listboxColorMap list = get(hObject,'String'); handles.mydata.ccolormap = list{get(hObject,'Value')}; guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function listboxColorMap_CreateFcn(hObject, eventdata, handles) % hObject handle to listboxColorMap (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: listbox controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function editFirstBin_Callback(hObject, eventdata, handles) % hObject handle to editFirstBin (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of editFirstBin as text % str2double(get(hObject,'String')) returns contents of editFirstBin as a double newcell = round(str2double(get(hObject,'String'))); if newcell < 1, newcell = 1; end if newcell > handles.mydata.ncells, newcell = handles.mydata.ncells; end handles.mydata.cells(1) = newcell; handles.mydata.newvar = 1; % tell update plot that we have switched.. new data loading % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function editFirstBin_CreateFcn(hObject, eventdata, handles) % hObject handle to editFirstBin (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function editLastBin_Callback(hObject, eventdata, handles) % hObject handle to editLastBin (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of editLastBin as text % str2double(get(hObject,'String')) returns contents of editLastBin as a double newcell = round(str2double(get(hObject,'String'))); if newcell < 1, newcell = 1; end if newcell > handles.mydata.ncells, newcell = handles.mydata.ncells; end handles.mydata.cells(2) = newcell; handles.mydata.newvar = 1; % tell update plot that we have switched.. new data loading % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function editLastBin_CreateFcn(hObject, eventdata, handles) % hObject handle to editLastBin (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function editColorMinValue_Callback(hObject, eventdata, handles) % hObject handle to editColorMinValue (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of editColorMinValue as text % str2double(get(hObject,'String')) returns contents of editColorMinValue as a double newvalue = get(hObject,'Value'); if newvalue < handles.mydata.ccmax, handles.mydata.ccmin = newvalue; else disp(sprintf('Value ignored: %7g >= %7g color maximum',... newvalue,handles.mydata.ccmax)) end set(handles.editColorMinValue,'string',sprintf('%7g',handles.mydata.ccmin)); % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function editColorMinValue_CreateFcn(hObject, eventdata, handles) % hObject handle to editColorMinValue (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function editColorMaxValue_Callback(hObject, eventdata, handles) % hObject handle to editColorMaxValue (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of editColorMaxValue as text % str2double(get(hObject,'String')) returns contents of editColorMaxValue as a double newvalue = str2double(get(hObject,'String')); if newvalue > handles.mydata.ccmin, handles.mydata.ccmax = newvalue; else disp(sprintf('Value ignored: %7g <= %7g color minimum',... newvalue,handles.mydata.ccmin)) end set(handles.editColorMaxValue,'string',sprintf('%7g',handles.mydata.ccmax)); % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function editColorMaxValue_CreateFcn(hObject, eventdata, handles) % hObject handle to editColorMaxValue (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end