annotate aim-mat/gui/aim.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 % main procedure for aim
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES: either a wave-file, a m-file or nothing
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 % for the nongraphic version, the result, otherwise non
tomwalters@0 7 %
tomwalters@0 8 % load the signal file and all files, that are in this directory
tomwalters@0 9 % set the project variables accordingly.
tomwalters@0 10 %
bleeck@3 11 %
tomwalters@0 12 % (c) 2011, University of Southampton
bleeck@3 13 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 14 % download of current version is on the soundsoftware site:
bleeck@3 15 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 16 % documentation and everything is on http://www.acousticscale.org
bleeck@3 17
bleeck@3 18
tomwalters@0 19
bleeck@2 20
tomwalters@0 21 function result=aim(varargin)
tomwalters@0 22
tomwalters@0 23 nrparams=length(varargin);
tomwalters@0 24 switch nrparams
tomwalters@0 25 case 0 % no argument, load a wave file and go to graphic version
tomwalters@0 26 [signame,dirname]=uigetfile('*.wav');
tomwalters@0 27 if isnumeric(signame)
tomwalters@0 28 return
tomwalters@0 29 end
tomwalters@0 30 cd(dirname);
tomwalters@0 31 aim_gui(signame);
tomwalters@0 32 return
tomwalters@0 33 case 1 % only one parameter, this can be the structure of parameters, or a wavefile
tomwalters@0 34 cname=varargin{1};
tomwalters@0 35 if isstruct(cname); % called with an struct
tomwalters@0 36 % result=aim_gui(cname);
tomwalters@0 37 result=aim_ng(cname);
tomwalters@0 38 return
tomwalters@0 39 end
tomwalters@0 40
tomwalters@0 41 % calling with a wavefile - open the graphic version
tomwalters@0 42 [pathstr,filename,ext] = fileparts(cname); %#ok
tomwalters@0 43 if strcmp(ext,'.wav') %
tomwalters@0 44 if fexist(cname) % yes, the wavefile is there! Is there also a directory?
tomwalters@0 45 aim_gui(cname);
tomwalters@0 46 return
tomwalters@0 47 else
tomwalters@0 48 str=sprintf('The wave-file %s does not exist in the current working directory %s',cname,pwd);
tomwalters@0 49 er=errordlg(str,'File Error');
tomwalters@0 50 set(er,'WindowStyle','modal');
tomwalters@0 51 return
tomwalters@0 52 end
tomwalters@0 53 else % called with a m-file
tomwalters@0 54 if strcmp(ext,'.m') % calling with a m-file?
tomwalters@0 55 if fexist(cname) % yes, the m-file is there, we call the nographic version:
tomwalters@0 56 result=aim_ng(cname);
tomwalters@0 57 return
tomwalters@0 58 else
tomwalters@0 59 str=sprintf('file %s does not exist in the current working directory %s',cname,pwd);
tomwalters@0 60 er=errordlg(str,'File Error');
tomwalters@0 61 set(er,'WindowStyle','modal');
tomwalters@0 62 return
tomwalters@0 63 end
tomwalters@0 64 end
tomwalters@0 65 end
tomwalters@0 66 end
tomwalters@0 67
tomwalters@0 68 disp('call ''aim'' with with a sound file or a m-parameter file');