% comparezsc gui to compare multiple LISST backscatter calibration files % % reads backscatter data generated by LISST.EXE, which are simply an % ASCII flat file of the 40 raw data values output by the LISST function varargout = comparezsc(varargin) % COMPAREZSC M-file for comparezsc.fig % COMPAREZSC, by itself, creates a new COMPAREZSC or raises the existing % singleton*. % % H = COMPAREZSC returns the handle to a new COMPAREZSC or the handle to % the existing singleton*. % % COMPAREZSC('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in COMPAREZSC.M with the given input arguments. % % COMPAREZSC('Property','Value',...) creates a new COMPAREZSC or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before comparezsc_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to comparezsc_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help comparezsc % Last Modified by GUIDE v2.5 19-Feb-2006 19:04:10 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @comparezsc_OpeningFcn, ... 'gui_OutputFcn', @comparezsc_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 comparezsc is made visible. function comparezsc_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 comparezsc (see VARARGIN) % Choose default command line output for comparezsc handles.output = hObject; [filename, pathname, filterindex] = uigetfile( ... {'factory*.asc','factory bacground scatter (factory*.asc)'}, ... 'Pick a factory backscatter file', 'Untitled.asc'); handles.factoryFile = fullfile(pathname,filename); if isempty(handles.factoryFile), return, end % user cancelled handles.fzsc = load(handles.factoryFile); [filename, pathname, filterindex] = uigetfile( ... {'*.asc','ASCII files (*.asc)'}, ... 'Pick one or more files', 'MultiSelect', 'on'); if iscell(filename), npicked = length(filename); else npicked = 1; junk{1} = filename; clear filename filename = junk; end for idx = 1:npicked, handles.zscFiles{idx} = fullfile(pathname,filename{idx}); disp(handles.zscFiles{idx}) end zsc = zeros(length(handles.zscFiles),length(handles.fzsc)); for idx = 1:npicked, data = load(handles.zscFiles{idx}); if isempty(data), disp(sprintf('No data from %s',handles.zscFiles{idx})) handles.zsc(idx,:) = zeros(1,length(handles.fzsc)); else handles.zsc(idx,:) = data; end end % 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 comparezsc wait for user response (see UIRESUME) % uiwait(handles.figure1); % ------------------ updates the plot - this is a user function function updateplot(hObject, handles) axes(handles.axes1); cla; plot(handles.fzsc(1:32),'k-*') hold on plot(handles.zsc(:,1:32)') ylabel('ring intensity') xlabel('ring (larger ring numbers detect smaller size classes') title('Comparison of LISST backscatter calibrations') [pathstr, name, ext] = fileparts(handles.factoryFile); lstring = sprintf('legend(''%s''',[name ext]); for idx = 1:length(handles.zscFiles), [pathstr, name, ext] = fileparts(handles.zscFiles{idx}); lstring = sprintf('%s,''%s''',lstring,[name ext]); end lstring = [lstring ',''Location'',''EastOutside'');']; eval(lstring) % Update handles structure guidata(hObject, handles); return % --- Outputs from this function are returned to the command line. function varargout = comparezsc_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 varargout{1} = handles.output; % --- Executes on button press in addzsc. function addzsc_Callback(hObject, eventdata, handles) % hObject handle to addzsc (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) nfiles = length(handles.zscFiles); [filename, pathname, filterindex] = uigetfile( ... {'*.asc','ASCII files (*.asc)'}, ... 'Pick one or more files', 'MultiSelect', 'on'); if iscell(filename), npicked = length(filename); else npicked = 1; junk{1} = filename; clear filename filename = junk; end for idx = 1:npicked, handles.zscFiles{nfiles+idx} = fullfile(pathname,filename{idx}); disp(handles.zscFiles{nfiles+idx}) end for idx = 1:npicked, data = load(handles.zscFiles{nfiles+idx}); if isempty(data), disp(sprintf('No data from %s',handles.zscFiles{nfiles+idx})) handles.zsc(nfiles+idx,:) = zeros(1,length(handles.fzsc)); else handles.zsc(nfiles+idx,:) = data; end end % Update handles structure guidata(hObject, handles); updateplot(hObject, handles) return % -------------------------------------------------------------------- function Untitled_1_Callback(hObject, eventdata, handles) % hObject handle to Untitled_1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)