0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 function varargout = atmlab_version
0024
0025
0026
0027 toppath = fileparts( fileparts( which( 'atmlab_version' ) ) );
0028
0029 changelog = fullfile( toppath, 'ChangeLog' );
0030
0031 fid = fopen( changelog, 'r' );
0032
0033 if fid < 0
0034 s = 'atmlab-?.? (could not locate ChangeLog file)';
0035 return
0036 end
0037
0038 s = '';
0039
0040 while isempty( findstr( s, 'atmlab-' ) )
0041 s = fgetl( fid );
0042 if ~ischar(s)
0043 error( 'Could not find any ''atmlab-'' in ChangeLog' );
0044 end
0045 end
0046
0047 fclose(fid);
0048
0049
0050 s = s( findstr(s,'atmlab-') : end );
0051
0052 ind = find( s == '-' );
0053
0054 s(ind(2:end)) = '.';
0055
0056 if nargout==0
0057
0058 fprintf('This is %s\n',s);
0059 clear s
0060
0061 elseif nargout == 1
0062 varargout{1} = s;
0063 elseif nargout == 3
0064 varargout = cellfun(@str2num, strsplit(s(8:end), '.'), 'UniformOutput', false);
0065 end
0066
0067 end