annotate aim-mat/gui/aim_loadcurrentstate.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % procedure for 'aim-mat'
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 %
tomwalters@0 7 %
bleeck@3 8 %
tomwalters@0 9 % (c) 2011, University of Southampton
bleeck@3 10 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 11 % download of current version is on the soundsoftware site:
bleeck@3 12 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 13 % documentation and everything is on http://www.acousticscale.org
bleeck@3 14
bleeck@3 15
tomwalters@0 16
tomwalters@0 17
tomwalters@0 18 function handles=aim_loadcurrentstate(handles)
tomwalters@0 19 % save some crucial information to a file
tomwalters@0 20
tomwalters@0 21 % standart setting, that prevent followup errors:
tomwalters@0 22 handles.info.init.start_time=0;
tomwalters@0 23 handles.info.init.duration=0.04;
tomwalters@0 24 handles.info.init.scale=1;
tomwalters@0 25 handles.info.current_figure=1;
tomwalters@0 26 handles.info.current_plot=1;
tomwalters@0 27 handles.info.init.hastime=0;
tomwalters@0 28 handles.info.init.hasfreq=0;
tomwalters@0 29 handles.info.init.hassignal=0;
tomwalters@0 30
tomwalters@0 31 if isfield(handles.info,'projectfilename')
tomwalters@0 32 projectfilename=handles.info.projectfilename;
tomwalters@0 33 if exist(projectfilename)==2
tomwalters@0 34 olddir=pwd;
tomwalters@0 35 cd(handles.info.directoryname);
tomwalters@0 36 [pathstr,name,ext] = fileparts(projectfilename);
tomwalters@0 37 eval(name);
tomwalters@0 38 cd(olddir);
tomwalters@0 39
tomwalters@0 40 try
tomwalters@0 41 % test if the current plot can be presented, or if it was maybe
tomwalters@0 42 % deleted in between. In this case set the current_plot to
tomwalters@0 43 % something resonable
tomwalters@0 44 if current_plot >6 && ~handles.info.usermodule_loaded
tomwalters@0 45 current_plot=6; start_time=0;
tomwalters@0 46 end
tomwalters@0 47 if current_plot > 5 && ~handles.info.sai_loaded
tomwalters@0 48 current_plot=5; start_time=0;
tomwalters@0 49 end
tomwalters@0 50 if current_plot > 4 && ~handles.info.strobes_loaded
tomwalters@0 51 current_plot=4; start_time=0;
tomwalters@0 52 end
tomwalters@0 53 if current_plot > 3 && ~handles.info.nap_loaded
tomwalters@0 54 current_plot=3; start_time=0;
tomwalters@0 55 end
tomwalters@0 56 if current_plot > 2 && ~handles.info.bmm_loaded
tomwalters@0 57 current_plot=2; start_time=0;
tomwalters@0 58 end
tomwalters@0 59 handles.info.current_plot=current_plot;
tomwalters@0 60
tomwalters@0 61 handles.info.init.start_time=start_time;
tomwalters@0 62 handles.info.init.duration=duration;
tomwalters@0 63 handles.info.init.scale=scale;
tomwalters@0 64
tomwalters@0 65 oldsize=get(handles.figure1,'Position');
tomwalters@0 66 pos(1)=winx;
tomwalters@0 67 pos(2)=winy;
tomwalters@0 68 pos(3)=oldsize(3);
tomwalters@0 69 pos(4)=oldsize(4);
tomwalters@0 70 set(handles.figure1,'Position',pos);
tomwalters@0 71
tomwalters@0 72 gpos(1)=grafixwinx;
tomwalters@0 73 gpos(2)=grafixwiny;
tomwalters@0 74 gpos(3)=grafixwinb;
tomwalters@0 75 gpos(4)=grafixwinh;
tomwalters@0 76 gnr=grafixwinnr;
tomwalters@0 77 figure(gnr);
tomwalters@0 78 clf;
tomwalters@0 79 set(gnr,'Position',gpos);
tomwalters@0 80 handles.info.current_figure=gnr;
tomwalters@0 81
tomwalters@0 82
tomwalters@0 83 if exist('hastime','var')
tomwalters@0 84 handles.info.init.hastime=hastime;
tomwalters@0 85 else
tomwalters@0 86 handles.info.init.hastime=0;
tomwalters@0 87 end
tomwalters@0 88 if exist('hasfreq','var')
tomwalters@0 89 handles.info.init.hasfreq=hasfreq;
tomwalters@0 90 else
tomwalters@0 91 handles.info.init.hasfreq=0;
tomwalters@0 92 end
tomwalters@0 93 if exist('hassignal','var')
tomwalters@0 94 handles.info.init.hassignal=hassignal;
tomwalters@0 95 else
tomwalters@0 96 handles.info.init.hassignal=0;
tomwalters@0 97 end
tomwalters@0 98 catch
tomwalters@0 99 disp('non fatal problem in reading the project file. Continue...');
tomwalters@0 100 end
tomwalters@0 101 end
tomwalters@0 102 end