diff --git a/@MyDaq/MyDaq.m b/@MyDaq/MyDaq.m index 86c7b8e..30146d9 100644 --- a/@MyDaq/MyDaq.m +++ b/@MyDaq/MyDaq.m @@ -1,940 +1,868 @@ classdef MyDaq < handle properties %Contains GUI handles Gui; %Contains Reference trace (MyTrace object) Ref=MyTrace(); %Contains Data trace (MyTrace object) Data=MyTrace(); %Contains Background trace (MyTrace object) Background; %Struct containing available instruments InstrList=struct(); %Struct containing MyInstrument objects Instruments=struct() %Struct containing Cursor objects Cursors=struct(); %Struct containing Cursor labels CrsLabels=struct(); %Struct containing MyFit objects Fits=struct(); %Input parser Parser; %Struct for listeners Listeners=struct(); %Sets the colors of fits, data and reference fit_color='k'; data_color='b'; ref_color='r'; %Properties for saving files base_dir; session_name; file_name; %Flag for enabling the GUI enable_gui; end properties (Dependent=true) save_dir; main_plot; open_fits; open_instrs; open_crs; instr_tags; instr_names; savefile; end methods %% Class functions %Constructor function function this=MyDaq(varargin) createParser(this); parse(this.Parser,varargin{:}); parseInputs(this); if this.enable_gui this.Gui=guihandles(eval('GuiDaq')); initGui(this); hold(this.main_plot,'on'); end initDaq(this) end function delete(this) %Deletes the MyFit objects and their listeners cellfun(@(x) delete(this.Fits.(x)), this.open_fits); cellfun(@(x) deleteListeners(this,x), this.open_fits); %Deletes the MyInstrument objects and their listeners cellfun(@(x) delete(this.Instruments.(x)), this.open_instrs); cellfun(@(x) deleteListeners(this,x), this.open_instrs); if this.enable_gui this.Gui.figure1.CloseRequestFcn=''; %Deletes the figure delete(this.Gui.figure1); %Removes the figure handle to prevent memory leaks this.Gui=[]; end end end methods (Access=private) %Creates parser for constructor function function createParser(this) p=inputParser; addParameter(p,'enable_gui',1); this.Parser=p; end %Sets the class variables to the inputs from the inputParser. function parseInputs(this) for i=1:length(this.Parser.Parameters) %Takes the value from the inputParser to the appropriate %property. if isprop(this,this.Parser.Parameters{i}) this.(this.Parser.Parameters{i})=... this.Parser.Results.(this.Parser.Parameters{i}); end end end %Initializes the class depending on the computer name function initDaq(this) computer_name=getenv('computername'); switch computer_name case 'LPQM1PCLAB2' initRt(this); case 'LPQM1PC18' initUhq(this); case 'LPQM1PC2' %Test case for testing on Nils' computer. otherwise error('Please create an initialization function for this computer') end %Initializes empty trace objects this.Ref=MyTrace; this.Data=MyTrace; this.Background=MyTrace; end %Sets callback functions for the GUI - function initGui(this) - %Close request function is set to delete function of the class - this.Gui.figure1.CloseRequestFcn=@(hObject,eventdata)... - closeFigure(this, hObject, eventdata); - %Sets callback for the edit box of the base directory - this.Gui.BaseDir.Callback=@(hObject, eventdata)... - baseDirCallback(this, hObject, eventdata); - %Sets callback for the session name edit box - this.Gui.SessionName.Callback=@(hObject, eventdata)... - sessionNameCallback(this, hObject, eventdata); - %Sets callback for the file name edit box - this.Gui.FileName.Callback=@(hObject, eventdata) ... - fileNameCallback(this, hObject,eventdata); - %Sets callback for the save data button - this.Gui.SaveData.Callback=@(hObject, eventdata) ... - saveDataCallback(this, hObject,eventdata); - %Sets callback for the save ref button - this.Gui.SaveRef.Callback=@(hObject, eventdata)... - saveRefCallback(this, hObject, eventdata); - %Sets callback for the show data button - this.Gui.ShowData.Callback=@(hObject, eventdata)... - showDataCallback(this, hObject, eventdata); - %Sets callback for the show reference button - this.Gui.ShowRef.Callback=@(hObject, eventdata)... - showRefCallback(this, hObject, eventdata); - %Sets callback for the data to reference button - this.Gui.DataToRef.Callback=@(hObject, eventdata)... - dataToRefCallback(this, hObject, eventdata); - %Sets callback for the LogY button - this.Gui.LogY.Callback=@(hObject, eventdata) ... - logYCallback(this, hObject, eventdata); - %Sets callback for the LogX button - this.Gui.LogX.Callback=@(hObject, eventdata)... - logXCallback(this, hObject, eventdata); - %Sets callback for the data to background button - this.Gui.DataToBg.Callback=@(hObject, eventdata) ... - dataToBgCallback(this, hObject,eventdata); - %Sets callback for the ref to background button - this.Gui.RefToBg.Callback=@(hObject, eventdata) ... - refToBgCallback(this, hObject,eventdata); - %Sets callback for the clear background button - this.Gui.ClearBg.Callback=@(hObject, eventdata)... - clearBgCallback(this, hObject,eventdata); - %Sets callback for the select trace popup menu - this.Gui.SelTrace.Callback=@(hObject,eventdata)... - selTraceCallback(this, hObject,eventdata); - %Sets callback for the vertical cursor button - this.Gui.VertDataButton.Callback=@(hObject, eventdata)... - cursorButtonCallback(this, hObject,eventdata); - %Sets callback for the horizontal cursors button - this.Gui.HorzDataButton.Callback=@(hObject, eventdata)... - cursorButtonCallback(this, hObject,eventdata); - %Sets callback for the reference cursors button - this.Gui.VertRefButton.Callback=@(hObject, eventdata)... - cursorButtonCallback(this, hObject,eventdata); - %Sets callback for the center cursors button - this.Gui.CenterCursors.Callback=@(hObject,eventdata)... - centerCursorsCallback(this,hObject,eventdata); - %Sets callback for the center cursors button - this.Gui.CopyPlot.Callback=@(hObject,eventdata)... - copyPlotCallback(this,hObject,eventdata); - %Sets callback for load trace button - this.Gui.LoadButton.Callback=@(hObject,eventdata)... - loadDataCallback(this,hObject,eventdata); - - %Initializes the AnalyzeMenu - this.Gui.AnalyzeMenu.Callback=@(hObject, eventdata)... - analyzeMenuCallback(this, hObject,eventdata); - this.Gui.AnalyzeMenu.String={'Select a routine...',... - 'Linear Fit','Quadratic Fit','Exponential Fit',... - 'Gaussian Fit','Lorentzian Fit','g0 calibration'}; - - %Initializes the InstrMenu - this.Gui.InstrMenu.Callback=@(hObject,eventdata) ... - instrMenuCallback(this,hObject,eventdata); - end + initGui(this) %Executes when the GUI is closed function closeFigure(this,~,~) delete(this); end %Adds an instrument to InstrList. Used by initialization functions. function addInstr(this,tag,name,type,interface,address) %Usage: addInstr(this,tag,name,type,interface,address) if ~ismember(tag,this.instr_tags) this.InstrList.(tag).name=name; this.InstrList.(tag).type=type; this.InstrList.(tag).interface=interface; this.InstrList.(tag).address=address; else error(['%s is already defined as an instrument. ',... 'Please choose a different tag'],tag); end end %Gets the tag corresponding to an instrument name function tag=getTag(this,instr_name) ind=cellfun(@(x) strcmp(this.InstrList.(x).name,instr_name),... this.instr_tags); tag=this.instr_tags{ind}; end %Opens the correct instrument function openInstrument(this,tag) instr_type=this.InstrList.(tag).type; %Collects the correct inputs for creating the MyInstrument %class input_cell={this.InstrList.(tag).name,... this.InstrList.(tag).interface,... this.InstrList.(tag).address}; switch instr_type case 'RSA' this.Instruments.(tag)=MyRsa(input_cell{:},... 'gui','GuiRsa'); case 'Scope' this.Instruments.(tag)=MyScope(input_cell{:},... 'gui','GuiScope'); case 'NA' this.Instruments.(tag)=MyNa(input_cell{:},... 'gui','GuiNa'); end %Adds listeners for new data and deletion of the instrument. %These call plot functions and delete functions respectively. this.Listeners.(tag).NewData=... addlistener(this.Instruments.(tag),'NewData',... @(src, eventdata) acquireNewData(this, src, eventdata)); this.Listeners.(tag).Deletion=... addlistener(this.Instruments.(tag),'ObjectBeingDestroyed',... @(src, eventdata) deleteInstrument(this, src, eventdata)); end %Updates fits function updateFits(this) %Pushes data into fits in the form of MyTrace objects, so that %units etc follow. for i=1:length(this.open_fits) this.Fits.(this.open_fits{i}).Data=getFitData(this,'VertData'); end end % If vertical cursors are on, takes only data %within cursors. Note the use of copy here! This is a handle %class, so if normal assignment is used, this.Fits.Data and %this.(trace_str) will refer to the same object, causing roblems. + %Name input is the name of the cursor to be used to extract data. + %If the cursor is not open, it takes all the data from the selected + %trace in the analysis trace selection dropdown function Trace=getFitData(this,name) %Finds out which trace the user wants to fit. trc_opts=this.Gui.SelTrace.String; trc_str=trc_opts{this.Gui.SelTrace.Value}; Trace=copy(this.(trc_str)); if ismember(name,fieldnames(this.Cursors)) ind=findCursorData(this, trc_str, name); Trace.x=this.(trc_str).x(ind); Trace.y=this.(trc_str).y(ind); end end %Finds data between named cursors in the given trace function ind=findCursorData(this, trc_str, name) crs_pos=sort([this.Cursors.(name){1}.Location,... this.Cursors.(name){2}.Location]); ind=(this.(trc_str).x>crs_pos(1) & this.(trc_str).x %Prints the figure to the clipboard print(newFig,'-clipboard','-dbitmap'); %Deletes the figure delete(newFig); end end methods %% Callbacks %Callback for copying the plot to clipboard function copyPlotCallback(this,~,~) copyPlot(this); end %Callback for centering cursors function centerCursorsCallback(this, ~, ~) if ~this.Gui.LogX.Value x_pos=mean(this.main_plot.XLim); else x_pos=10^(mean(log10(this.main_plot.XLim))); end if ~this.Gui.LogX.Value y_pos=mean(this.main_plot.YLim); else y_pos=10^(mean(log10(this.main_plot.YLim))); end for i=1:length(this.open_crs) switch this.Cursors.(this.open_crs{i}){1}.Orientation case 'horizontal' pos=y_pos; case 'vertical' pos=x_pos; end %Centers the position cellfun(@(x) set(x,'Location',pos), ... this.Cursors.(this.open_crs{i})); %Triggers the UpdateCursorBar event, which triggers %listener callback to reposition text cellfun(@(x) notify(x,'UpdateCursorBar'),... this.Cursors.(this.open_crs{i})); cellfun(@(x) notify(x,'EndDrag'),... this.Cursors.(this.open_crs{i})); end end %Callback for creating vertical data cursors function cursorButtonCallback(this, hObject, ~) name=erase(hObject.Tag,'Button'); %Gets the first four characters of the tag (Vert or Horz) type=name(1:4); if hObject.Value hObject.BackgroundColor=[0,1,0.2]; createCursors(this,name,type); else hObject.BackgroundColor=[0.941,0.941,0.941]; deleteCursors(this,name); end end %Callback for the instrument menu function instrMenuCallback(this,hObject,~) val=hObject.Value; if val~=1 names=hObject.String; tag=getTag(this,names(val)); else tag=''; end %If instrument is valid and not open, opens it. If it is valid %and open it changes focus to the instrument control window. if ismember(tag,this.instr_tags) && ... ~ismember(tag,this.open_instrs) openInstrument(this,tag); elseif ismember(tag,this.open_instrs) figure(this.Instruments.(tag).figure1); end end %Select trace callback function selTraceCallback(this, ~, ~) updateFits(this) end %Saves the data if the save data button is pressed. function saveDataCallback(this, ~, ~) if this.Data.validatePlot save(this.Data,'save_dir',this.save_dir,'name',... this.savefile) else error('Data trace was empty, could not save'); end end %Saves the reference if the save ref button is pressed. function saveRefCallback(this, ~, ~) if this.Data.validatePlot save(this.Ref,'save_dir',this.save_dir,'name',... this.savefile) else error('Reference trace was empty, could not save') end end %Toggle button callback for showing the data trace. function showDataCallback(this, hObject, ~) if hObject.Value hObject.BackgroundColor=[0,1,0.2]; setVisible(this.Data,this.main_plot,1); else hObject.BackgroundColor=[0.941,0.941,0.941]; setVisible(this.Data,this.main_plot,0); end end %Toggle button callback for showing the ref trace function showRefCallback(this, hObject, ~) if hObject.Value hObject.BackgroundColor=[0,1,0.2]; setVisible(this.Ref,this.main_plot,1); else hObject.BackgroundColor=[0.941,0.941,0.941]; setVisible(this.Ref,this.main_plot,0); end end %Callback for moving the data to reference. function dataToRefCallback(this, ~, ~) if this.Data.validatePlot this.Ref.x=this.Data.x; this.Ref.y=this.Data.y; this.Ref.plotTrace(this.main_plot,'Color',this.ref_color); this.Ref.setVisible(this.main_plot,1); updateFits(this); this.Gui.ShowRef.Value=1; this.Gui.ShowRef.BackgroundColor=[0,1,0.2]; else warning('Data trace was empty, could not move to reference') end end %Callback for ref to bg button. Sends the reference to background function refToBgCallback(this, ~, ~) if this.Ref.validatePlot this.Background.x=this.Ref.x; this.Background.y=this.Ref.y; this.Background.plotTrace(this.main_plot); this.Background.setVisible(this.main_plot,1); else warning('Reference trace was empty, could not move to background') end end %Callback for data to bg button. Sends the data to background function dataToBgCallback(this, ~, ~) if this.Data.validatePlot this.Background.x=this.Data.x; this.Background.y=this.Data.y; this.Background.plotTrace(this.main_plot); this.Background.setVisible(this.main_plot,1); else warning('Data trace was empty, could not move to background') end end %Callback for clear background button. Clears the background function clearBgCallback(this, ~, ~) this.Background.x=[]; this.Background.y=[]; this.Background.setVisible(this.main_plot,0); end %Callback for LogY button. Sets the YScale to log/lin function logYCallback(this, hObject, ~) if hObject.Value this.main_plot.YScale='Log'; hObject.BackgroundColor=[0,1,0.2]; updateCursors(this); else this.main_plot.YScale='Linear'; hObject.BackgroundColor=[0.941,0.941,0.941]; updateCursors(this); end end %Callback for LogX button. Sets the XScale to log/lin function logXCallback(this, hObject, ~) if get(hObject,'Value') set(this.main_plot,'XScale','Log'); set(hObject, 'BackgroundColor',[0,1,0.2]); updateCursors(this); else set(this.main_plot,'XScale','Linear'); set(hObject, 'BackgroundColor',[0.941,0.941,0.941]); updateCursors(this); end end %Base directory callback function baseDirCallback(this, hObject, ~) this.base_dir=hObject.String; for i=1:length(this.open_fits) this.Fits.(this.open_fits{i}).save_dir=this.save_dir; end end %Callback for session name edit box. Sets the session name. function sessionNameCallback(this, hObject, ~) this.session_name=hObject.String; for i=1:length(this.open_fits) this.Fits.(this.open_fits{i}).save_dir=this.save_dir; end end %Callback for filename edit box. Sets the file name. function fileNameCallback(this, hObject,~) this.file_name=hObject.String; for i=1:length(this.open_fits) this.Fits.(this.open_fits{i}).save_name=this.file_name; end end %Callback for the analyze menu (popup menu for selecting fits). %Opens the correct MyFit object. function analyzeMenuCallback(this, hObject, ~) analyze_ind=hObject.Value; %Finds the correct fit name analyze_name=hObject.String{analyze_ind}; analyze_name=analyze_name(1:(strfind(analyze_name,' ')-1)); analyze_name=[upper(analyze_name(1)),analyze_name(2:end)]; switch analyze_name case {'Linear','Quadratic','Lorentzian','Gaussian'} openMyFit(this,analyze_name); case 'G0' openMyG(this); end end function openMyFit(this,fit_name) %Sees if the fit object is already open, if it is, changes the %focus to it, if not, opens it. if ismember(fit_name,fieldnames(this.Fits)) %Changes focus to the relevant fit window figure(this.Fits.(fit_name).Gui.Window); else %Gets the data for the fit using the getFitData function %with the vertical cursors DataTrace=getFitData(this,'VertData'); %Makes an instance of MyFit with correct parameters. this.Fits.(fit_name)=MyFit(... 'fit_name',fit_name,... 'enable_plot',1,... 'plot_handle',this.main_plot,... 'Data',DataTrace,... 'save_dir',this.save_dir,... 'save_name',this.file_name); %Sets up a listener for the Deletion event, which %removes the MyFit object from the Fits structure if it is %deleted. this.Listeners.(fit_name).Deletion=... addlistener(this.Fits.(fit_name),'ObjectBeingDestroyed',... @(src, eventdata) deleteFit(this, src, eventdata)); %Sets up a listener for the NewFit. Callback plots the fit %on the main plot. this.Listeners.(fit_name).NewFit=... addlistener(this.Fits.(fit_name),'NewFit',... @(src, eventdata) plotNewFit(this, src, eventdata)); %Sets up a listener for NewInitVal this.Listeners.(fit_name).NewInitVal=... addlistener(this.Fits.(fit_name),'NewInitVal',... @(~,~) updateCursors(this)); end end function openMyG(this) MechTrace=getFitData(this,'VertData'); CalTrace=getFitData(this,'VertRef'); this.Fits.G0=MyG('MechTrace',MechTrace,'CalTrace',CalTrace,... 'name','G0'); %Adds listener for object being destroyed this.Listeners.G0.Deletion=addlistener(this.Fits.G0,... 'ObjectBeingDestroyed',... @(~,~) deleteObj(this,'G0')); end function loadDataCallback(this, ~, ~) if isempty(this.base_dir) warning('Please input a valid folder name for loading a trace'); this.base_dir=pwd; end try [load_name,path_name]=uigetfile('.txt','Select the trace',... this.base_dir); load_path=[path_name,load_name]; dest_trc=this.Gui.DestTrc.String{this.Gui.DestTrc.Value}; loadTrace(this.(dest_trc),load_path); this.(dest_trc).plotTrace(this.main_plot,... 'Color',this.(sprintf('%s_color',lower(dest_trc)))); catch error('Please select a valid file'); end end %% Listener functions %Callback function for NewFit listener. Plots the fit in the %window using the plotFit function of the MyFit object function plotNewFit(this, src, ~) src.plotFit('Color',this.fit_color); updateCursors(this); end %Callback function for the NewData listener function acquireNewData(this, src, ~) this.Data=src.Trace; clearData(src); this.Data.plotTrace(this.main_plot,'Color',this.data_color) updateCursors(this); updateFits(this); end %Callback function for MyInstrument ObjectBeingDestroyed listener. %Removes the relevant field from the Instruments struct and deletes %the listeners from the object function deleteInstrument(this, src, ~) %Deletes the object from the Instruments struct tag=getTag(this, src.name); if ismember(tag, this.open_instrs) this.Instruments=rmfield(this.Instruments,tag); end %Deletes the listeners from the Listeners struct deleteListeners(this, tag); end %Callback function for MyFit ObjectBeingDestroyed listener. %Removes the relevant field from the Fits struct and deletes the %listeners from the object. function deleteFit(this, src, ~) %Deletes the object from the Fits struct and deletes listeners deleteObj(this,src.fit_name); %Clears the fits src.clearFit; %Updates cursors since the fits are removed from the plot updateCursors(this); end function deleteObj(this,name) if ismember(name,this.open_fits) this.Fits=rmfield(this.Fits,name); end deleteListeners(this, name); end %Listener update function for vertical cursor function vertCursorUpdate(this, src) %Finds the index of the cursor. All cursors are tagged %(name)1, (name)2, e.g. VertData2, ind is the number. ind=str2double(src.Tag(end)); tag=src.Tag(1:(end-1)); %Moves the cursor labels set(this.CrsLabels.(tag){ind},'Position',[src.Location,... this.CrsLabels.(tag){ind}.Position(2),0]); if strcmp(tag,'VertData') %Sets the edit box displaying the location of the cursor this.Gui.(sprintf('EditV%d',ind)).String=... num2str(src.Location); %Sets the edit box displaying the difference in locations this.Gui.EditV2V1.String=... num2str(this.Cursors.VertData{2}.Location-... this.Cursors.VertData{1}.Location); end end %Listener update function for horizontal cursor function horzCursorUpdate(this, src) %Finds the index of the cursor. All cursors are tagged %(name)1, (name)2, e.g. VertData2, ind is the number. ind=str2double(src.Tag(end)); tag=src.Tag(1:(end-1)); %Moves the cursor labels set(this.CrsLabels.(tag){ind},'Position',... [this.CrsLabels.(tag){ind}.Position(1),... src.Location,0]); if strcmp(tag,'HorzData') %Sets the edit box displaying the location of the cursor this.Gui.(sprintf('EditH%d',ind)).String=... num2str(src.Location); %Sets the edit box displaying the difference in locations this.Gui.EditH2H1.String=... num2str(this.Cursors.HorzData{2}.Location-... this.Cursors.HorzData{1}.Location); end end %Function that deletes listeners from the listeners struct, %corresponding to an object of name obj_name function deleteListeners(this, obj_name) %Finds if the object has listeners in the listeners structure if ismember(obj_name, fieldnames(this.Listeners)) %Grabs the fieldnames of the object's listeners structure names=fieldnames(this.Listeners.(obj_name)); for i=1:length(names) %Deletes the listeners delete(this.Listeners.(obj_name).(names{i})); %Removes the field from the structure this.Listeners.(obj_name)=... rmfield(this.Listeners.(obj_name),names{i}); end %Removes the object's field from the structure this.Listeners=rmfield(this.Listeners, obj_name); end end %% Set functions function set.base_dir(this,base_dir) if ~strcmp(base_dir(end),'\') base_dir(end+1)='\'; end this.base_dir=base_dir; end %% Get functions %Get function from save directory function save_dir=get.save_dir(this) save_dir=[this.base_dir,datestr(now,'yyyy-mm-dd '),... this.session_name,'\']; end %Get function for the plot handles function main_plot=get.main_plot(this) if this.enable_gui main_plot=this.Gui.figure1.CurrentAxes; else main_plot=[]; end end %Get function for available instrument tags function instr_tags=get.instr_tags(this) instr_tags=fieldnames(this.InstrList); end %Get function for open fits function open_fits=get.open_fits(this) open_fits=fieldnames(this.Fits); end %Get function for open instrument tags function open_instrs=get.open_instrs(this) open_instrs=fieldnames(this.Instruments); end %Get function for instrument names function instr_names=get.instr_names(this) %Cell of strings is output, so UniformOutput must be 0. instr_names=cellfun(@(x) this.InstrList.(x).name, ... this.instr_tags,'UniformOutput',0); end %Generates appropriate file name for the save file. function savefile=get.savefile(this) if get(this.Gui.AutoName,'Value') date_time = datestr(now,'yyyy-mm-dd_HHMMSS'); else date_time=''; end savefile=[this.file_name,date_time]; end %Get function that displays names of open cursors function open_crs=get.open_crs(this) open_crs=fieldnames(this.Cursors); end end end \ No newline at end of file diff --git a/@MyDaq/initGui.m b/@MyDaq/initGui.m new file mode 100644 index 0000000..c6fe30f --- /dev/null +++ b/@MyDaq/initGui.m @@ -0,0 +1,77 @@ +function initGui(this) +%Close request function is set to delete function of the class +this.Gui.figure1.CloseRequestFcn=@(hObject,eventdata)... + closeFigure(this, hObject, eventdata); +%Sets callback for the edit box of the base directory +this.Gui.BaseDir.Callback=@(hObject, eventdata)... + baseDirCallback(this, hObject, eventdata); +%Sets callback for the session name edit box +this.Gui.SessionName.Callback=@(hObject, eventdata)... + sessionNameCallback(this, hObject, eventdata); +%Sets callback for the file name edit box +this.Gui.FileName.Callback=@(hObject, eventdata) ... + fileNameCallback(this, hObject,eventdata); +%Sets callback for the save data button +this.Gui.SaveData.Callback=@(hObject, eventdata) ... + saveDataCallback(this, hObject,eventdata); +%Sets callback for the save ref button +this.Gui.SaveRef.Callback=@(hObject, eventdata)... + saveRefCallback(this, hObject, eventdata); +%Sets callback for the show data button +this.Gui.ShowData.Callback=@(hObject, eventdata)... + showDataCallback(this, hObject, eventdata); +%Sets callback for the show reference button +this.Gui.ShowRef.Callback=@(hObject, eventdata)... + showRefCallback(this, hObject, eventdata); +%Sets callback for the data to reference button +this.Gui.DataToRef.Callback=@(hObject, eventdata)... + dataToRefCallback(this, hObject, eventdata); +%Sets callback for the LogY button +this.Gui.LogY.Callback=@(hObject, eventdata) ... + logYCallback(this, hObject, eventdata); +%Sets callback for the LogX button +this.Gui.LogX.Callback=@(hObject, eventdata)... + logXCallback(this, hObject, eventdata); +%Sets callback for the data to background button +this.Gui.DataToBg.Callback=@(hObject, eventdata) ... + dataToBgCallback(this, hObject,eventdata); +%Sets callback for the ref to background button +this.Gui.RefToBg.Callback=@(hObject, eventdata) ... + refToBgCallback(this, hObject,eventdata); +%Sets callback for the clear background button +this.Gui.ClearBg.Callback=@(hObject, eventdata)... + clearBgCallback(this, hObject,eventdata); +%Sets callback for the select trace popup menu +this.Gui.SelTrace.Callback=@(hObject,eventdata)... + selTraceCallback(this, hObject,eventdata); +%Sets callback for the vertical cursor button +this.Gui.VertDataButton.Callback=@(hObject, eventdata)... + cursorButtonCallback(this, hObject,eventdata); +%Sets callback for the horizontal cursors button +this.Gui.HorzDataButton.Callback=@(hObject, eventdata)... + cursorButtonCallback(this, hObject,eventdata); +%Sets callback for the reference cursors button +this.Gui.VertRefButton.Callback=@(hObject, eventdata)... + cursorButtonCallback(this, hObject,eventdata); +%Sets callback for the center cursors button +this.Gui.CenterCursors.Callback=@(hObject,eventdata)... + centerCursorsCallback(this,hObject,eventdata); +%Sets callback for the center cursors button +this.Gui.CopyPlot.Callback=@(hObject,eventdata)... + copyPlotCallback(this,hObject,eventdata); +%Sets callback for load trace button +this.Gui.LoadButton.Callback=@(hObject,eventdata)... + loadDataCallback(this,hObject,eventdata); + +%Initializes the AnalyzeMenu +this.Gui.AnalyzeMenu.Callback=@(hObject, eventdata)... + analyzeMenuCallback(this, hObject,eventdata); +%List of available analysis routines +this.Gui.AnalyzeMenu.String={'Select a routine...',... + 'Linear Fit','Quadratic Fit','Exponential Fit',... + 'Gaussian Fit','Lorentzian Fit','g0 calibration'}; + +%Initializes the InstrMenu +this.Gui.InstrMenu.Callback=@(hObject,eventdata) ... + instrMenuCallback(this,hObject,eventdata); +end \ No newline at end of file