view aim-mat/gui/aim.m @ 2:8bd33a2931a3

fixed email
author Stefan Bleeck <bleeck@soton.ac.uk>
date Fri, 20 May 2011 12:42:38 +0100
parents 74dedb26614d
children 20ada0af3d7d
line wrap: on
line source
% main procedure for aim
% 
%   INPUT VALUES: either a wave-file, a m-file or nothing
%  
%   RETURN VALUE:
%		for the nongraphic version, the result, otherwise non
%
% load the signal file and all files, that are in this directory
% set the project variables accordingly.
%
% (c) 2011, University of Southampton
% Maintained and written by Stefan Bleeck (bleeck@gmail.com)
% http://www.soton.ac.uk/aim


function result=aim(varargin)

nrparams=length(varargin);
switch nrparams
	case 0 % no argument, load a wave file and go to graphic version
		[signame,dirname]=uigetfile('*.wav');
		if isnumeric(signame)
			return		
		end
		cd(dirname);
		aim_gui(signame);
		return
	case 1 % only one parameter, this can be the structure of parameters, or a wavefile
		cname=varargin{1};
		if isstruct(cname);	% called with an struct
% 			result=aim_gui(cname);
			result=aim_ng(cname);
			return
		end
		
		% calling with a wavefile - open the graphic version
		[pathstr,filename,ext] = fileparts(cname); %#ok
		if strcmp(ext,'.wav') % 
			if fexist(cname)	% yes, the wavefile is there! Is there also a directory?
				aim_gui(cname);
				return
			else 
				str=sprintf('The wave-file %s does not exist in the current working directory %s',cname,pwd);
				er=errordlg(str,'File Error');
				set(er,'WindowStyle','modal');
				return
			end
		else % called with a m-file
			if strcmp(ext,'.m') % calling with a m-file?
				if fexist(cname)	% yes, the m-file is there, we call the nographic version:
					result=aim_ng(cname);
					return
				else
					str=sprintf('file %s does not exist in the current working directory %s',cname,pwd);
					er=errordlg(str,'File Error');
					set(er,'WindowStyle','modal');
					return
				end
			end
		end
end

disp('call ''aim'' with with a sound file or a m-parameter file');