% browsehydraburst - browse ADV burst file data by burst (works for PCADP too) % % browsehydraburst('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 % 16 Nov 2005 % -- call gregorian instead of gregoria % 14 Sep 2005 % -- fix the problem of missing bursts (in the case of multiple samplign % scenarios) now handled gracefully % Version 2.5 % 15 Mar 2005 There is a java bug in version R14 (no SP) and lower that % limits how far numerically a slider will go. To turn off java so this % works, use feature('javafigures',0) or upgrade to R14 SP2 % Last Modified by GUIDE v2.5 28-Aug-2009 13:21:07 function varargout = browsehydraburst(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @browsehydraburst_OpeningFcn, ... 'gui_OutputFcn', @browsehydraburst_OutputFcn, ... 'gui_LayoutFcn', [], ... 'gui_Callback', []); if nargin & isstr(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 browsehydraburst is made visible. function browsehydraburst_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 browsehydraburst (see VARARGIN) % Choose default command line output for browsehydraburst handles.output = hObject; % figure1: 1.000034179687500e+002 % slider1: 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, filterindex] = uigetfile('*.*','Open a netCDF file containing burst Hydra 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 theCommand = 'if ~isempty(get(gcf,''UserData'')), close(get(gcf,''UserData'')); end;'; set(handles.figure1,'DeleteFcn',theCommand); % 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 handles.mydata.isprofiler = 0; if length(cdf{'depth'}) > 1, % find out if this is a PCADP % PCADP raw data file shape is handles.mydata.isprofiler = 1; handles.mydata.ncells = length(cdf{'depth'}); for n=1:handles.mydata.ncells, handles.mydata.lstrings{n} = sprintf('%d',n); end else handles.mydata.ncells = 1; handles.mydata.isprofiler = 0; end set(handles.text7,'string',sprintf('Now browsing file %s',handles.mydata.burstfile)) %clear this first handles.mydata.varnames=[]; 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},'bindist'), % do nothing else handles.mydata.varnames{n} = varnames{i}; n=n+1; end end handles.mydata.varnames{end+1} = 'speed'; handles.mydata.varnames{end+1} = 'direction'; handles.mydata.varnames{end+1} = 'prog. vect.'; handles.mydata.vartoplot = handles.mydata.varnames{1}; handles.mydata.iburst = 1; s = size(cdf{'time'}); handles.mydata.nbursts = s(1); handles.mydata.nsamples = s(2); handles.mydata.nsamplesinview = handles.mydata.nsamples; handles.mydata.samples = [1 handles.mydata.nsamplesinview]; 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 if isempty(handles.mydata.burstNum), handles.mydata.burstNum = cdf{'burstNum'}(:); end handles.mydata.icell = 1; handles.mydata.cellsinview = [1 handles.mydata.ncells]; set(handles.editFirstCell,'String','1'); set(handles.editFirstCell,'Tooltipstring','enter the first cell in view') set(handles.editLastCell,'String',sprintf('%d',handles.mydata.ncells)); set(handles.editLastCell,'Tooltipstring','enter the last cell in view') % slider 1 - zoom within a burst set(handles.text1,'string',sprintf('%3.0f',handles.mydata.minsamplesinview)); set(handles.text4,'string',sprintf('%3.0f in view',handles.mydata.nsamples)); % slider 1 limits -- maybe change the view zoom for the number of samples set(handles.slider1,'Value',handles.mydata.nsamples,'Min',handles.mydata.minsamplesinview,... 'Max',handles.mydata.nsamples,'SliderStep',[1/handles.mydata.nsamples 5/handles.mydata.nsamples]); set(handles.slider1,'Tooltipstring','Restrict the number of samples in view (zoom)') % slider 2 - burst selector - labels %set(handles.text2,'string',sprintf('%d',cdf{'burst'}(1))); set(handles.text2,'string',sprintf('%d',handles.mydata.burstNum(1))); %set(handles.text6,'string',sprintf('%d bursts',cdf{'burst'}(end))); 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') % slider 3 - sample selector - labels set(handles.text3,'string',sprintf('%d',1)); if ~handles.mydata.isprofiler, set(handles.text5,'string',sprintf('%d samples in burst',length(cdf('sample')))); else set(handles.text5,'string',sprintf('%d samples in burst',length(cdf('profile')))); end %set slider 3 limits set(handles.slider3,'Value',1,'Min',handles.mydata.samples(1),'Max',handles.mydata.samples(2)) set(handles.slider3,'Tooltipstring','Select which part of burst to display (if zoomed)') % put varnames into listbox here set(handles.listbox1,'string',handles.mydata.varnames,'Value',1); set(handles.listbox1,'Tooltipstring','Select data to display') % set the goto box to the first burst set(handles.editBurstNum,'String',sprintf('%d',handles.mydata.burstNum(handles.mydata.iburst))); set(handles.editBurstNum,'Tooltipstring','enter a burst number to jump to') handles.mydata.TwoDtoggle = 1; set(handles.togglebutton1,'Value',1); set(handles.togglebutton1,'String','Get Line Plot'); set(handles.togglebutton1,'Tooltipstring','Push to switch to line plot') % 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 browsehydraburst 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; cells = handles.mydata.cellsinview; %disp(sprintf('updateplot: iburst = %d',handles.mydata.iburst)) tm1 = datenum(gregorian(cdf{'time'}(handles.mydata.iburst,samples(1)))); tm1 = tm1+cdf{'time2'}(handles.mydata.iburst,samples(1))./(24*3600*1000); cburst = cdf{'burst'}(handles.mydata.iburst); axes(handles.axis1); cla; % if handles.mydata.createfigure, % handles.mydata.createfigure = 0; % end switch vartoplot case 'speed' ncobj = cdf{'u_1205'}; ncobj = autonan(ncobj,1); u = ncobj(handles.mydata.iburst,samples(1):samples(2),cells(1):cells(2)); ncobj = cdf{'v_1206'}; ncobj = autonan(ncobj,1); v = ncobj(handles.mydata.iburst,samples(1):samples(2),cells(1):cells(2)); [d, s] = uv2polar(u,v); if handles.mydata.TwoDtoggle, pcolor(s'); shading flat; ylabel('cell') cax = colorbar; caxyl = get(cax,'ylabel'); set(caxyl,'string',cdf{'u_1205'}.units(:)) else plot(samples(1):samples(2),s); ylabel(cdf{'u_1205'}.units(:)); end case 'direction' ncobj = cdf{'u_1205'}; ncobj = autonan(ncobj,1); u = ncobj(handles.mydata.iburst,samples(1):samples(2),cells(1):cells(2)); ncobj = cdf{'v_1206'}; ncobj = autonan(ncobj,1); v = ncobj(handles.mydata.iburst,samples(1):samples(2),cells(1):cells(2)); [d, s] = uv2polar(u,v); if handles.mydata.TwoDtoggle, pcolor(d'); shading flat; ylabel('cell') cax = colorbar; caxyl = get(cax,'ylabel'); set(caxyl,'string','degrees') else plot(samples(1):samples(2),d); ylabel('degrees'); end case 'prog. vect.' u = cdf{'u_1205'}(handles.mydata.iburst,samples(1):samples(2),cells(1):cells(2)); v = cdf{'v_1206'}(handles.mydata.iburst,samples(1):samples(2),cells(1):cells(2)); [r, c] = size(u); if r>1 && c>1, % two D, skip for now.. text(0.2, 0.5, 'Unable to plot progressive vector of more than one cell yet',... 'units','normalized') else dt = 1/cdf.ADVDeploymentSetupSampleRate(1); xc = cumsum(u.*dt)./100; yc = cumsum(v.*dt)./100; plot(xc,yc); ylabel('North-South, m'); xlabel('East-West, m'); end otherwise %data = cdf{vartoplot}(handles.mydata.iburst,samples(1):samples(2),cells(1):cells(2)); ncobj = cdf{vartoplot}; ncobj = autonan(ncobj,1); data = ncobj(handles.mydata.iburst,samples(1):samples(2),cells(1):cells(2)); [r,c] = size(data); if handles.mydata.TwoDtoggle && r>1 && c>1, pcolor(data'); shading flat; ylabel('cell') cax = colorbar; caxyl = get(cax,'ylabel'); set(caxyl,'string',cdf{vartoplot}.units(:)) else plot(samples(1):samples(2),data); ylabel(cdf{vartoplot}.units(:)); end end xlabel('samples') %deal with any '_ in variable names if(findstr('_',vartoplot)) val=findstr('_',vartoplot); vartoplot=[vartoplot(1:val-1) '\' vartoplot(val:end)]; clear val end text(0.0,1.05,sprintf('%s at %s, burst #%d, samples #%d to %d',vartoplot,... datestr(tm1), cburst, samples(1), samples(2)),'units','normalized'); if handles.mydata.isprofiler && ~handles.mydata.TwoDtoggle, if ~isvector(data), idx = handles.mydata.cellsinview(1):handles.mydata.cellsinview(2); for n=1:length(idx), handles.mydata.lstrings{n} = sprintf('bin %d mean %5.2f',idx(n),gmean(data(:,n))); end legend(handles.mydata.lstrings{cells(1):cells(2)},'Location','EastOutside'); end end % Update handles structure guidata(hObject, handles); % --- Outputs from this function are returned to the command line. function varargout = browsehydraburst_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 slider1_CreateFcn(hObject, eventdata, handles) % hObject handle to slider1 (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 slider1_Callback(hObject, eventdata, handles) % hObject handle to slider1 (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 handles.mydata.nsamplesinview = round(get(hObject,'Value')); % now reset the view limits accordingly, use the first point as the anchor handles.mydata.samples(2) = handles.mydata.samples(1)+handles.mydata.nsamplesinview-1; if handles.mydata.samples(2) > handles.mydata.nsamples, handles.mydata.samples(2) = handles.mydata.nsamples; handles.mydata.samples(1) = handles.mydata.nsamples-handles.mydata.nsamplesinview; end if handles.mydata.samples(1) <= 0, handles.mydata.samples(1) = 1; end % 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.editBurstNum,'String',sprintf('%d',cburst)); % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function slider3_CreateFcn(hObject, eventdata, handles) % hObject handle to slider3 (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 slider3_Callback(hObject, eventdata, handles) % hObject handle to slider3 (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 %disp(handles.mydata.pcprof) handles.mydata.samples(1) = round(get(hObject,'Value')); % now reset the view limits accordingly, use middle as the anchor handles.mydata.samples(2) = handles.mydata.samples(1)+handles.mydata.nsamplesinview-1; if handles.mydata.samples(2) > handles.mydata.nsamples, handles.mydata.samples(2) = handles.mydata.nsamples; handles.mydata.samples(1) = handles.mydata.nsamples-handles.mydata.nsamplesinview; end if handles.mydata.samples(1) <= 0, handles.mydata.samples(1) = 1; end % 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')}; guidata(hObject, handles); updateplot(hObject, handles); function editBurstNum_Callback(hObject, eventdata, handles) % hObject handle to editBurstNum (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 editBurstNum as text % str2double(get(hObject,'String')) returns contents of editBurstNum 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 editBurstNum_CreateFcn(hObject, eventdata, handles) % hObject handle to editBurstNum (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) % % TODO this is crashing on %??? Undefined function or variable "v". fprintf('Not yet implemented\n') % 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); % if isempty(rdim), rdim = cdf('time'); end; % if not known, then guess % for n = 1:length(ncobj), % if strcmp(ncnames(rdim),ncnames(ncobj{n})), % cdfe(ncnames(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,:,:) % fprintf('Burst %d copied to %s\n',cburst,newname) % close(cdfe) function editFirstCell_Callback(hObject, eventdata, handles) % hObject handle to editFirstCell (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) handles.mydata.cellsinview(1) = round(str2double(get(hObject,'String'))); if handles.mydata.cellsinview(1)<=0, handles.mydata.cellsinview(1) = 1; elseif handles.mydata.cellsinview(1) > handles.mydata.ncells, handles.mydata.cellsinview(1) = handles.mydata.ncells-1; % gotta plot something... end if handles.mydata.cellsinview(2) <= handles.mydata.cellsinview(1), fprintf('Last cell %d <= first cell %d, guessing on display...\n',... handles.mydata.cellsinview(2), handles.mydata.cellsinview(1)) handles.mydata.cellsinview(2) = handles.mydata.cellsinview(1)+1; end % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function editFirstCell_CreateFcn(hObject, eventdata, handles) % hObject handle to editFirstCell (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 editLastCell_Callback(hObject, eventdata, handles) % hObject handle to editLastCell (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) handles.mydata.cellsinview(2) = round(str2double(get(hObject,'String'))); if handles.mydata.cellsinview(2)<=0, handles.mydata.cellsinview(2) = 2; % gotta plot something! elseif handles.mydata.cellsinview(2) > handles.mydata.ncells, handles.mydata.cellsinview(2) = handles.mydata.ncells; % gotta plot something... end if handles.mydata.cellsinview(2) <= handles.mydata.cellsinview(1), fprintf('Last cell %d <= first cell %d, guessing on display...\n',... handles.mydata.cellsinview(2), handles.mydata.cellsinview(1)) handles.mydata.cellsinview(2) = handles.mydata.cellsinview(1)+1; end % Update handles structure guidata(hObject, handles); updateplot(hObject, handles); % --- Executes during object creation, after setting all properties. function editLastCell_CreateFcn(hObject, eventdata, handles) % hObject handle to editLastCell (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 % --- Executes on button press in togglebutton1. function togglebutton1_Callback(hObject, eventdata, handles) % hObject handle to togglebutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of togglebutton1 handles.mydata.TwoDtoggle = get(hObject,'Value'); if handles.mydata.TwoDtoggle, % now applying mask, switch %set(handles.togglebutton1,'BackgroundColor',[0 1 0]); set(handles.togglebutton1,'String','Get Line Plot'); set(handles.togglebutton1,'Tooltipstring','Push to switch to line plot') else %set(handles.togglebutton1,'BackgroundColor',[236 233 216]); set(handles.togglebutton1,'String','Get Pcolor Plot'); set(handles.togglebutton1,'Tooltipstring','Push to switch to pcolor plot') end guidata(gcf, handles); %guidata(hObject, handles); updateplot(hObject, handles);