tomwalters@0: % procedure for 'aim-mat' tomwalters@0: % function varargout = aim(varargin) tomwalters@0: % INPUT VALUES: tomwalters@0: % varargin: either a wave-file, a parameter file (m-file) or an tomwalters@0: % parameter struct tomwalters@0: % RETURN VALUE: tomwalters@0: % with a parameter file, the result of the processing, otherwise none tomwalters@0: % bleeck@3: % tomwalters@0: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: bleeck@3: tomwalters@0: tomwalters@0: tomwalters@0: function varargout = aim(varargin) tomwalters@0: tomwalters@0: % check the version tomwalters@0: tomwalters@0: gui_Singleton = 0; tomwalters@0: gui_State = struct('gui_Name', mfilename, ... tomwalters@0: 'gui_Singleton', gui_Singleton, ... tomwalters@0: 'gui_OpeningFcn', @aim_OpeningFcn, ... tomwalters@0: 'gui_OutputFcn', @aim_OutputFcn, ... tomwalters@0: 'gui_LayoutFcn', [] , ... tomwalters@0: 'gui_Callback', []); tomwalters@0: if nargin && isstr(varargin{1}) tomwalters@0: fistletter=varargin{1}(1); tomwalters@0: % if ~isempty(str2num(fistletter)) tomwalters@0: % disp('matlab does not like wave files that start with numbers. Please change first letter!'); tomwalters@0: % return tomwalters@0: % end tomwalters@0: gui_State.gui_Callback = str2func(varargin{1}); tomwalters@0: end tomwalters@0: tomwalters@0: % something for the eye: tomwalters@0: if length(varargin)==1 % only at the first call tomwalters@0: fpa=which('gen_gtfb'); % ugly hack to get the graphics... sorry! tomwalters@0: [a,b,c]=fileparts(fpa); tomwalters@0: where=strfind(a,'modules'); tomwalters@0: if ~isempty(where) tomwalters@0: columnpath=fpa(1:where+7); tomwalters@0: handles.info.columnpath=columnpath; tomwalters@0: if ~isstruct(varargin{1})% no box for call with struct tomwalters@0: prname=varargin{1}; tomwalters@0: prname=prname(1:end-4); tomwalters@0: if exist(prname)==7 % is there a directory with the same name? tomwalters@0: handles.abouttexttodisplay=sprintf('loading existing project ''%s'' ...',prname); tomwalters@0: else tomwalters@0: handles.abouttexttodisplay=sprintf('creating new project ''%s'' ...',prname); tomwalters@0: end tomwalters@0: f=aim_displayaboutbox(handles); tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: % Aufruf des guis: tomwalters@0: if nargout tomwalters@0: [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); tomwalters@0: else tomwalters@0: gui_mainfcn(gui_State, varargin{:}); tomwalters@0: end tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %close the annoying about-box tomwalters@0: if exist('f','var') && ishandle(f) tomwalters@0: name=get(f,'name'); tomwalters@0: if ~isempty(strfind(name,'About')) tomwalters@0: close(f); tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: function aim_OpeningFcn(hObject, eventdata, handles, varargin) tomwalters@0: handles.output = hObject; tomwalters@0: tomwalters@0: verstrst=ver; tomwalters@0: nrproducts=length(verstrst); tomwalters@0: for i=1:nrproducts tomwalters@0: verstr=verstrst(i); tomwalters@0: if strcmp(verstr.Name,'MATLAB') % just making sure... tomwalters@0: vernr=str2num(verstr.Version); tomwalters@0: if vernr<6.5 tomwalters@0: str='aim-mat requires MATLAB version 6.5 or higher!'; tomwalters@0: disp(str); tomwalters@0: er=errordlg(str,'Version error'); tomwalters@0: set(er,'WindowStyle','modal'); tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: % per default we work with graphic tomwalters@0: handles.with_graphic=1; tomwalters@0: % no error so far tomwalters@0: handles.error=0; tomwalters@0: tomwalters@0: tomwalters@0: % handles.screen_modus='paper'; % can be 'screen' or 'paper' - chooses the colors and styles tomwalters@0: handles.screen_modus='screen'; % tomwalters@0: tomwalters@0: if isstruct(varargin{1}) tomwalters@0: all_options=varargin{1}; tomwalters@0: filename=all_options.signal.signal_filename; tomwalters@0: handles.autorun=1; % start running after loading tomwalters@0: handles.initial_options=all_options; % start with these options tomwalters@0: else tomwalters@0: filename=varargin{1}; tomwalters@0: handles.autorun=0; % dont start running after loading tomwalters@0: end tomwalters@0: tomwalters@0: % initiate the parameters from an old version or do it new: tomwalters@0: handles=init_aim_parameters(handles,filename); tomwalters@0: if handles.error==1 tomwalters@0: close(handles.figure1); tomwalters@0: return tomwalters@0: end tomwalters@0: tomwalters@0: % reset the graphic to standart values: tomwalters@0: handles=init_aim_gui(handles); tomwalters@0: movegui(handles.figure1,'south'); tomwalters@0: tomwalters@0: % set the close function to my own tomwalters@0: set(handles.figure1,'CloseRequestFcn',{@quitprogram,handles}) tomwalters@0: tomwalters@0: if handles.autorun==1 tomwalters@0: if isfield(handles.initial_options,'pcp') tomwalters@0: set(handles.checkbox0,'Value',1); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'bmm') tomwalters@0: set(handles.checkbox1,'Value',1); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'nap') tomwalters@0: set(handles.checkbox2,'Value',1); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'strobes') tomwalters@0: set(handles.checkbox3,'Value',1); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'sai') tomwalters@0: set(handles.checkbox4,'Value',1); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'usermodule') tomwalters@0: set(handles.checkbox8,'Value',1); tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: % do the changes and go on! tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: tomwalters@0: if handles.autorun==1 tomwalters@0: old_all_options=handles.all_options; tomwalters@0: handles.all_options=all_options; tomwalters@0: handles.info.no_automatic_parameter_update=1; tomwalters@0: % now tell the info, which modules we want. This is the same routine as tomwalters@0: % in the no-grafic version: tomwalters@0: tomwalters@0: handles.info.calculate_signal=0; tomwalters@0: handles.info.calculate_pcp=0; tomwalters@0: handles.info.calculate_bmm=0; tomwalters@0: handles.info.calculate_nap=0; tomwalters@0: handles.info.calculate_strobes=0; tomwalters@0: handles.info.calculate_sai=0; tomwalters@0: handles.info.calculate_usermodule=0; tomwalters@0: handles.info.calculate_movie=0; tomwalters@0: % now find out, which column we want to calculate: tomwalters@0: if isfield(all_options,'pcp') tomwalters@0: handles.info.calculate_pcp=1; tomwalters@0: module_names=fieldnames(all_options.pcp); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_pcp_module=module_name; % this one is the current one tomwalters@0: handles.all_options.pcp=all_options.pcp; % copy the parameters in place tomwalters@0: end tomwalters@0: if isfield(all_options,'bmm') tomwalters@0: handles.info.calculate_bmm=1; tomwalters@0: module_names=fieldnames(all_options.bmm); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_bmm_module=module_name; % this one is the current one tomwalters@0: handles.all_options.bmm=all_options.bmm; % copy the parameters in place tomwalters@0: end tomwalters@0: if isfield(all_options,'nap') tomwalters@0: handles.info.calculate_nap=1; tomwalters@0: module_names=fieldnames(all_options.nap); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_nap_module=module_name; % this one is the current one tomwalters@0: handles.all_options.nap=all_options.nap; % copy the parameters in place tomwalters@0: end tomwalters@0: if isfield(all_options,'strobes') tomwalters@0: handles.info.calculate_strobes=1; tomwalters@0: module_names=fieldnames(all_options.strobes); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_strobes_module=module_name; % this one is the current one tomwalters@0: handles.all_options.strobes=all_options.strobes; % copy the parameters in place tomwalters@0: end tomwalters@0: if isfield(all_options,'sai') tomwalters@0: handles.info.calculate_sai=1; tomwalters@0: module_names=fieldnames(all_options.sai); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_sai_module=module_name; % this one is the current one tomwalters@0: handles.all_options.sai=all_options.sai; % copy the parameters in place tomwalters@0: end tomwalters@0: if isfield(all_options,'usermodule') tomwalters@0: handles.info.calculate_usermodule=1; tomwalters@0: module_names=fieldnames(all_options.usermodule); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_usermodule_module=module_name; % this one is the current one tomwalters@0: handles.all_options.usermodule=all_options.usermodule; % copy the parameters in place tomwalters@0: end tomwalters@0: if isfield(all_options,'movie') tomwalters@0: handles.info.calculate_movie=1; tomwalters@0: module_names=fieldnames(all_options.movie); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_movie_module=module_name; % this one is the current one tomwalters@0: handles.all_options.movie=all_options.movie; % copy the parameters in place tomwalters@0: end tomwalters@0: tomwalters@0: % up to here copy of nowgrafic. If I ever have time, I think of something tomwalters@0: % more elegant tomwalters@0: tomwalters@0: handles=do_aim_calculate(handles); tomwalters@0: handles.all_options=old_all_options; tomwalters@0: tomwalters@0: if isfield(all_options,'pcp') tomwalters@0: result=handles.data.pcp; tomwalters@0: end tomwalters@0: if isfield(all_options,'bmm') tomwalters@0: result=handles.data.bmm; tomwalters@0: end tomwalters@0: if isfield(all_options,'nap') tomwalters@0: result=handles.data.nap; tomwalters@0: end tomwalters@0: if isfield(all_options,'strobes') tomwalters@0: result=handles.data.strobes; tomwalters@0: end tomwalters@0: if isfield(all_options,'sai') tomwalters@0: result=handles.data.sai; tomwalters@0: end tomwalters@0: if isfield(all_options,'pitch_image') tomwalters@0: result=handles.data.pitch_image; tomwalters@0: end tomwalters@0: if isfield(all_options,'usermodule') tomwalters@0: result=handles.data.usermodule; tomwalters@0: end tomwalters@0: tomwalters@0: handles.output=result; tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: end tomwalters@0: tomwalters@0: function varargout = aim_OutputFcn(hObject, eventdata, handles) tomwalters@0: if isfield(handles,'output') tomwalters@0: result.result=handles.output; tomwalters@0: result.error=0; tomwalters@0: result.all_options=handles.all_options; tomwalters@0: result.info=handles.info; tomwalters@0: % copy all data to the output, it is usefull sometimes! tomwalters@0: if isfield(handles.info,'no_automatic_parameter_update') tomwalters@0: if isfield(handles.all_options,'pcp') tomwalters@0: result.result=handles.data.pcp; tomwalters@0: end tomwalters@0: if isfield(handles.all_options,'bmm') tomwalters@0: result.result=handles.data.bmm; tomwalters@0: end tomwalters@0: if isfield(handles.all_options,'nap') tomwalters@0: result.result=handles.data.nap; tomwalters@0: end tomwalters@0: if isfield(handles.all_options,'strobes') tomwalters@0: result.result=handles.data.strobes; tomwalters@0: end tomwalters@0: if isfield(handles.all_options,'sai') tomwalters@0: result.result=handles.data.sai; tomwalters@0: end tomwalters@0: if isfield(handles.all_options,'usermodule') tomwalters@0: result.result=handles.data.usermodule; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: varargout{1} = result; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %% Menufunktions %%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function exit_Callback(hObject, eventdata, handles) tomwalters@0: quitprogram(hObject, eventdata, handles); tomwalters@0: function about_Callback(hObject, eventdata, handles) tomwalters@0: aim_displayaboutbox(handles); tomwalters@0: function file_Callback(hObject, eventdata, handles) tomwalters@0: function help_Callback(hObject, eventdata, handles) tomwalters@0: tomwalters@0: % load a new sound tomwalters@0: function loadsound_Callback(hObject, eventdata, handles) tomwalters@0: [signame,dirname]=uigetfile('*.wav'); tomwalters@0: if ~isnumeric(dirname) tomwalters@0: cd(dirname); tomwalters@0: if fexist(signame) tomwalters@0: handles=init_aim_parameters(handles,signame); tomwalters@0: handles=init_aim_gui(handles); tomwalters@0: else tomwalters@0: return tomwalters@0: end tomwalters@0: else tomwalters@0: return tomwalters@0: end tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: tomwalters@0: % exchange the soundfile and keep the rest tomwalters@0: function exchange_Callback(hObject, eventdata, handles) tomwalters@0: [signame,dirname]=uigetfile('*.wav'); tomwalters@0: if ~isnumeric(dirname) tomwalters@0: cd(dirname); tomwalters@0: if fexist(signame) tomwalters@0: handles=aim_exchange_sound_file(handles,signame); tomwalters@0: % handles=init_aim_gui(handles); tomwalters@0: else tomwalters@0: return tomwalters@0: end tomwalters@0: else tomwalters@0: return tomwalters@0: end tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: function edit_Callback(hObject, eventdata, handles) tomwalters@0: function opencool_Callback(hObject, eventdata, handles) tomwalters@0: wavename=sprintf('%s/%s',pwd,handles.info.signalwavename); tomwalters@0: if ispc tomwalters@0: winopen(wavename); tomwalters@0: else tomwalters@0: disp('sorry, cant open external file in unix...'); tomwalters@0: end tomwalters@0: tomwalters@0: function internethelp_Callback(hObject, eventdata, handles) tomwalters@0: helpname=sprintf('%shelp.html',handles.info.columnpath); tomwalters@0: if ispc tomwalters@0: winopen(helpname); tomwalters@0: else tomwalters@0: disp('sorry, cant open external file in unix...'); tomwalters@0: end tomwalters@0: tomwalters@0: function Untitled_1_Callback(hObject, eventdata, handles) tomwalters@0: function sptool_Callback(hObject, eventdata, handles) tomwalters@0: sig=handles.data.signal; tomwalters@0: adaptedspecgramdemo(getvalues(sig),getsr(sig)); tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%% save standalone parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function saveasparameters_Callback(hObject, eventdata, handles) tomwalters@0: [fname,dirname]=uiputfile('*.m','Save stand alone parameter file'); tomwalters@0: if isempty(strfind(fname,'.m')) tomwalters@0: fname=[fname '.m']; tomwalters@0: end tomwalters@0: filename=fullfile(dirname,fname); tomwalters@0: aim_saveparameters(handles,filename,0); % the 0 indicates, that only the relevant parameters are important tomwalters@0: tomwalters@0: %%%%%%% open personal default file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function open_personal_Callback(hObject, eventdata, handles) tomwalters@0: edit('personal_defaults.m'); tomwalters@0: tomwalters@0: %%%%%%% open current generating function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function edit_genfunc_Callback(hObject, eventdata, handles) tomwalters@0: [generating_module,generating_function,coptions]=aim_getcurrent_module(handles,handles.info.current_plot); tomwalters@0: edit(generating_function); tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%% edit parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function edit_params_Callback(hObject, eventdata, handles) tomwalters@0: dir=handles.info.original_soundfile_directory; tomwalters@0: filename=fullfile(dir,handles.info.parameterfilename); tomwalters@0: edit(filename); tomwalters@0: %%%%%%% diaplay versions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function version_Callback(hObject, eventdata, handles) tomwalters@0: aim_display_versions(handles); tomwalters@0: tomwalters@0: function copydata_Callback(hObject, eventdata, handles) tomwalters@0: assignin('base','data',handles.data); tomwalters@0: assignin('base','info',handles.info); tomwalters@0: tomwalters@0: % select the start point and the end point of the signal tomwalters@0: function select_time_Callback(hObject, eventdata, handles) tomwalters@0: oldoptions=handles.all_options.signal; tomwalters@0: sig=handles.data.original_signal; tomwalters@0: % out=adaptedspecgramdemo(getvalues(sig),getsr(sig),oldoptions.start_time,oldoptions.start_time+oldoptions.duration); tomwalters@0: % handles.all_options.signal.start_time=out.start; tomwalters@0: % handles.all_options.signal.duration=out.duration; tomwalters@0: tomwalters@0: current_start=handles.all_options.signal.start_time; tomwalters@0: current_duration=handles.all_options.signal.duration; tomwalters@0: allowed_duration=handles.all_options.signal.original_duration; tomwalters@0: text{1}=''; tomwalters@0: text{2}=''; tomwalters@0: tomwalters@0: [start,duration]=length_questionbox(current_start,current_duration,allowed_duration,text); tomwalters@0: handles.all_options.signal.start_time=start; tomwalters@0: handles.all_options.signal.duration=duration; tomwalters@0: tomwalters@0: if ~structisequal(oldoptions,handles.all_options.signal) tomwalters@0: aim_saveparameters(handles,handles.info.parameterfilename,1); % save the new parameters to the file tomwalters@0: % handles.info.calculate_signal=1; tomwalters@0: handles.all_options.signal=oldoptions; % tell him to use the new ones! tomwalters@0: handles=do_aim_updateparameters(handles); tomwalters@0: % handles=do_aim_calculate(handles); tomwalters@0: handles=update(hObject, eventdata, handles,4); tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %% PushButtons %%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: tomwalters@0: %%%%%%% play sound %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function pushbutton23_Callback(hObject, eventdata, handles) tomwalters@0: play(handles.data.signal); tomwalters@0: % signal tomwalters@0: function pushbutton22_Callback(hObject, eventdata, handles) tomwalters@0: handles.info.current_plot=1; tomwalters@0: handles=update(hObject, eventdata, handles,4); tomwalters@0: %pcp tomwalters@0: function pushbutton0_Callback(hObject, eventdata, handles) tomwalters@0: handles.info.current_plot=2; tomwalters@0: if get(handles.checkbox0,'Value')==1 tomwalters@0: handles=do_aim_calculate(handles); tomwalters@0: end tomwalters@0: handles=update(hObject, eventdata, handles,4); tomwalters@0: % bmm tomwalters@0: function pushbutton2_Callback(hObject, eventdata, handles) tomwalters@0: handles.info.current_plot=3; tomwalters@0: if get(handles.checkbox1,'Value')==1 tomwalters@0: handles=do_aim_calculate(handles); tomwalters@0: end tomwalters@0: handles=update(hObject, eventdata, handles,4); tomwalters@0: % nap tomwalters@0: function pushbutton3_Callback(hObject, eventdata, handles) tomwalters@0: handles.info.current_plot=4; tomwalters@0: if get(handles.checkbox2,'Value')==1 tomwalters@0: handles=do_aim_calculate(handles); tomwalters@0: end tomwalters@0: handles=update(hObject, eventdata, handles,4); tomwalters@0: % strobes tomwalters@0: function pushbutton4_Callback(hObject, eventdata, handles) tomwalters@0: handles.info.current_plot=5; tomwalters@0: if get(handles.checkbox3,'Value')==1 tomwalters@0: handles=do_aim_calculate(handles); tomwalters@0: end tomwalters@0: handles=update(hObject, eventdata, handles,4); tomwalters@0: % sai tomwalters@0: function pushbutton5_Callback(hObject, eventdata, handles) tomwalters@0: handles.info.current_plot=6; tomwalters@0: if get(handles.checkbox4,'Value')==1 tomwalters@0: handles=do_aim_calculate(handles); tomwalters@0: end tomwalters@0: sai=handles.data.sai; tomwalters@0: nr_chan=getnrchannels(sai{1}); tomwalters@0: if nr_chan==1 tomwalters@0: set(handles.checkbox6,'Value',0); %switch off frequency profile tomwalters@0: set(handles.checkbox7,'Value',0); %switch off temporal profile tomwalters@0: else tomwalters@0: set(handles.checkbox6,'Value',1); %switch on frequency profile tomwalters@0: set(handles.checkbox7,'Value',1); %switch on temporal profile tomwalters@0: end tomwalters@0: handles=update(hObject, eventdata, handles,4); tomwalters@0: % usermodule tomwalters@0: function pushbutton21_Callback(hObject, eventdata, handles) tomwalters@0: handles.info.current_plot=7; tomwalters@0: if get(handles.checkbox8,'Value')==1 tomwalters@0: handles=do_aim_calculate(handles); tomwalters@0: end tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: % movie tomwalters@0: function pushbutton6_Callback(hObject, eventdata, handles) tomwalters@0: if get(handles.checkbox5,'Value')==1 tomwalters@0: handles=do_aim_calculate(handles); tomwalters@0: end tomwalters@0: % generating_module_string=get(handles.listbox5,'String'); tomwalters@0: % generating_module=generating_module_string(get(handles.listbox5,'Value')); tomwalters@0: % generating_module=generating_module{1}; tomwalters@0: % uniqueworkingname=handles.info.uniqueworkingname; tomwalters@0: directoryname=handles.info.directoryname; tomwalters@0: % moviename=sprintf('%s/%s/%s.%s.mov',pwd,directoryname,uniqueworkingname,generating_module); tomwalters@0: tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: tomwalters@0: moviename=fullfile(pwd,directoryname,handles.info.last_movie_name_generated); tomwalters@0: if ispc tomwalters@0: winopen(moviename); tomwalters@0: else tomwalters@0: disp('sorry, cant open external file in unix...'); tomwalters@0: end tomwalters@0: tomwalters@0: % autoscale tomwalters@0: function pushbuttonautoscale_Callback(hObject, eventdata, handles) tomwalters@0: handles=do_aim_autoscale(handles); tomwalters@0: handles=update(hObject, eventdata, handles,1); tomwalters@0: tomwalters@0: % update tomwalters@0: function pushbutton25_Callback(hObject, eventdata, handles) tomwalters@0: handles=do_aim_updateparameters(handles); tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: % single channel tomwalters@0: function pushbutton24_Callback(hObject, eventdata, handles) tomwalters@0: if ~isfield(handles.info,'children') tomwalters@0: fig=figure; tomwalters@0: handles.info.children.single_channel.windowhandle=fig; tomwalters@0: else tomwalters@0: figure(handles.info.children.single_channel.windowhandle) tomwalters@0: end tomwalters@0: tomwalters@0: single_channel_gui(handles); tomwalters@0: guidata(hObject, handles); tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %% Listboxes %%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function listbox0_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function listbox1_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function listbox2_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function listbox3_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function listbox4_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function listbox5_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function listbox6_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: tomwalters@0: % pcp tomwalters@0: function listbox0_Callback(hObject, eventdata, handles) tomwalters@0: % TODO: tomwalters@0: % oldmodule=handles.info.current_pcp_module; tomwalters@0: set(handles.checkbox0,'Value',1); % set the tick to indicate, that it has changed tomwalters@0: handles=update(hObject, eventdata, handles,3); tomwalters@0: % newmodule=handles.info.current_pcp_module; tomwalters@0: % if strcmp(oldmodule,newmodule) tomwalters@0: % set(handles.checkbox0,'Value',0); % remove the tick again tomwalters@0: % end tomwalters@0: % bmm tomwalters@0: function listbox1_Callback(hObject, eventdata, handles) tomwalters@0: set(handles.checkbox1,'Value',1); tomwalters@0: handles=update(hObject, eventdata, handles,5); tomwalters@0: % nap tomwalters@0: function listbox2_Callback(hObject, eventdata, handles) tomwalters@0: set(handles.checkbox2,'Value',1); tomwalters@0: handles=update(hObject, eventdata, handles,5); tomwalters@0: % strobes tomwalters@0: function listbox3_Callback(hObject, eventdata, handles) tomwalters@0: set(handles.checkbox3,'Value',1); tomwalters@0: handles=update(hObject, eventdata, handles,5); tomwalters@0: % sai tomwalters@0: function listbox4_Callback(hObject, eventdata, handles) tomwalters@0: set(handles.checkbox4,'Value',1); tomwalters@0: handles=update(hObject, eventdata, handles,5); tomwalters@0: %usermodule tomwalters@0: function listbox6_Callback(hObject, eventdata, handles) tomwalters@0: set(handles.checkbox8,'Value',1); tomwalters@0: handles=update(hObject, eventdata, handles,5); tomwalters@0: % movie tomwalters@0: function listbox5_Callback(hObject, eventdata, handles) tomwalters@0: set(handles.checkbox5,'Value',1); tomwalters@0: handles=update(hObject, eventdata, handles,5); tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %% Checkboxes %%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %pcp tomwalters@0: function checkbox0_Callback(hObject, eventdata, handles) tomwalters@0: handles=aim_updatecheckboxes(hObject, eventdata, handles,1); tomwalters@0: handles=update(hObject, eventdata, handles,3); tomwalters@0: %bmm tomwalters@0: function checkbox1_Callback(hObject, eventdata, handles) tomwalters@0: handles=aim_updatecheckboxes(hObject, eventdata, handles,2); tomwalters@0: handles=update(hObject, eventdata, handles,3); tomwalters@0: %nap tomwalters@0: function checkbox2_Callback(hObject, eventdata, handles) tomwalters@0: handles=aim_updatecheckboxes(hObject, eventdata, handles,3); tomwalters@0: handles=update(hObject, eventdata, handles,3); tomwalters@0: %strobes tomwalters@0: function checkbox3_Callback(hObject, eventdata, handles) tomwalters@0: handles=aim_updatecheckboxes(hObject, eventdata, handles,4); tomwalters@0: handles=update(hObject, eventdata, handles,3); tomwalters@0: %sai tomwalters@0: function checkbox4_Callback(hObject, eventdata, handles) tomwalters@0: handles=aim_updatecheckboxes(hObject, eventdata, handles,5); tomwalters@0: handles=update(hObject, eventdata, handles,3); tomwalters@0: % usermodule tomwalters@0: function checkbox8_Callback(hObject, eventdata, handles) tomwalters@0: handles=aim_updatecheckboxes(hObject, eventdata, handles,6); tomwalters@0: handles=update(hObject, eventdata, handles,3); tomwalters@0: %movies tomwalters@0: function checkbox5_Callback(hObject, eventdata, handles) tomwalters@0: handles=aim_updatecheckboxes(hObject, eventdata, handles,7); tomwalters@0: handles=update(hObject, eventdata, handles,3); tomwalters@0: tomwalters@0: % show the time waveform on top tomwalters@0: function checkbox10_Callback(hObject, eventdata, handles) tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: function checkbox6_Callback(hObject, eventdata, handles) tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: %show interval profile tomwalters@0: function checkbox7_Callback(hObject, eventdata, handles) tomwalters@0: handles=update(hObject, eventdata, handles,2); tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %% Sliders %%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function slider1_CreateFcn(hObject, eventdata, handles) tomwalters@0: usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function slider2_CreateFcn(hObject, eventdata, handles) tomwalters@0: usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function slider3_CreateFcn(hObject, eventdata, handles) tomwalters@0: usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: tomwalters@0: function slider1_Callback(hObject, eventdata, handles) tomwalters@0: handles=slider_scale(hObject, eventdata, handles); tomwalters@0: handles=update(hObject, eventdata, handles,1); tomwalters@0: tomwalters@0: function slider2_Callback(hObject, eventdata, handles) tomwalters@0: handles=slider_start(hObject, eventdata, handles); tomwalters@0: handles=update(hObject, eventdata, handles,1); tomwalters@0: tomwalters@0: function slider3_Callback(hObject, eventdata, handles) tomwalters@0: handles=slider_duration(hObject, eventdata, handles); tomwalters@0: handles=update(hObject, eventdata, handles,1); tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %% Edits %%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: function edit1_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function edit2_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: function edit3_CreateFcn(hObject, eventdata, handles) tomwalters@0: if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end tomwalters@0: tomwalters@0: function edit1_Callback(hObject, eventdata, handles) tomwalters@0: handles=edit_scale(hObject, eventdata, handles); tomwalters@0: handles=update(hObject, eventdata, handles,1); tomwalters@0: function edit2_Callback(hObject, eventdata, handles) tomwalters@0: handles=edit_start(hObject, eventdata, handles); tomwalters@0: handles=update(hObject, eventdata, handles,1); tomwalters@0: function edit3_Callback(hObject, eventdata, handles) tomwalters@0: handles=edit_duration(hObject, eventdata, handles); tomwalters@0: handles=update(hObject, eventdata, handles,1); tomwalters@0: tomwalters@0: tomwalters@0: function handles=update(hObject, eventdata, handles,action) tomwalters@0: tomwalters@0: % check, if the singlechannel window was closed: (this is here, because it tomwalters@0: % is checked most often tomwalters@0: if isfield(handles.info,'children') tomwalters@0: if ~ishandle(handles.info.children.single_channel.windowhandle) tomwalters@0: rmfield(handles.info.children,'single_channel'); tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: handles.calling_object=hObject; tomwalters@0: tomwalters@0: if action>1 tomwalters@0: handles=aim_updategui(handles); tomwalters@0: end tomwalters@0: tomwalters@0: % if we want to see the interval profile: tomwalters@0: tomwalters@0: if get(handles.checkbox7,'Value')==1 tomwalters@0: options.withtime=true; tomwalters@0: else tomwalters@0: options.withtime=false; tomwalters@0: end tomwalters@0: % and if we want to see the frequency profile: tomwalters@0: if get(handles.checkbox6,'Value')==1 tomwalters@0: options.withfre=islogical(true); tomwalters@0: else tomwalters@0: options.withfre=islogical(0); tomwalters@0: end tomwalters@0: % do we want to see the signal? tomwalters@0: if get(handles.checkbox10,'Value')==1 tomwalters@0: options.withsignal=islogical(true); tomwalters@0: else tomwalters@0: options.withsignal=islogical(0); tomwalters@0: end tomwalters@0: % if there has never been a figure, create a new one tomwalters@0: if ~isfield(handles.info,'current_figure') tomwalters@0: handles.info.current_figure=figure; tomwalters@0: end tomwalters@0: options.figure_handle=handles.info.current_figure; tomwalters@0: tomwalters@0: switch action tomwalters@0: case {1,2} tomwalters@0: handles=aim_replotgraphic(handles,options); tomwalters@0: aim_savecurrentstate(handles);% save the state of the project and the window to a file tomwalters@0: guidata(hObject, handles); tomwalters@0: case 3 tomwalters@0: aim_savecurrentstate(handles);% save the state of the project and the window to a file tomwalters@0: guidata(hObject, handles); tomwalters@0: case 4 % everything with autoscale (for click on button) tomwalters@0: handles=do_aim_autoscale(handles); tomwalters@0: handles=aim_replotgraphic(handles,options); tomwalters@0: aim_savecurrentstate(handles);% save the state of the project and the window to a file tomwalters@0: guidata(hObject, handles); tomwalters@0: case 5 tomwalters@0: guidata(hObject, handles); tomwalters@0: end tomwalters@0: tomwalters@0: