tomwalters@0: % main procedure for aim tomwalters@0: % tomwalters@0: % INPUT VALUES: either a wave-file, a m-file or nothing tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % for the nongraphic version, the result, otherwise non tomwalters@0: % tomwalters@0: % load the signal file and all files, that are in this directory tomwalters@0: % set the project variables accordingly. 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: bleeck@2: tomwalters@0: function result=aim(varargin) tomwalters@0: tomwalters@0: nrparams=length(varargin); tomwalters@0: switch nrparams tomwalters@0: case 0 % no argument, load a wave file and go to graphic version tomwalters@0: [signame,dirname]=uigetfile('*.wav'); tomwalters@0: if isnumeric(signame) tomwalters@0: return tomwalters@0: end tomwalters@0: cd(dirname); tomwalters@0: aim_gui(signame); tomwalters@0: return tomwalters@0: case 1 % only one parameter, this can be the structure of parameters, or a wavefile tomwalters@0: cname=varargin{1}; tomwalters@0: if isstruct(cname); % called with an struct tomwalters@0: % result=aim_gui(cname); tomwalters@0: result=aim_ng(cname); tomwalters@0: return tomwalters@0: end tomwalters@0: tomwalters@0: % calling with a wavefile - open the graphic version tomwalters@0: [pathstr,filename,ext] = fileparts(cname); %#ok tomwalters@0: if strcmp(ext,'.wav') % tomwalters@0: if fexist(cname) % yes, the wavefile is there! Is there also a directory? tomwalters@0: aim_gui(cname); tomwalters@0: return tomwalters@0: else tomwalters@0: str=sprintf('The wave-file %s does not exist in the current working directory %s',cname,pwd); tomwalters@0: er=errordlg(str,'File Error'); tomwalters@0: set(er,'WindowStyle','modal'); tomwalters@0: return tomwalters@0: end tomwalters@0: else % called with a m-file tomwalters@0: if strcmp(ext,'.m') % calling with a m-file? tomwalters@0: if fexist(cname) % yes, the m-file is there, we call the nographic version: tomwalters@0: result=aim_ng(cname); tomwalters@0: return tomwalters@0: else tomwalters@0: str=sprintf('file %s does not exist in the current working directory %s',cname,pwd); tomwalters@0: er=errordlg(str,'File Error'); tomwalters@0: set(er,'WindowStyle','modal'); tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: disp('call ''aim'' with with a sound file or a m-parameter file');