home *** CD-ROM | disk | FTP | other *** search
- function ver(arg)
- %VER MATLAB version number.
- % VER displays the current MATLAB and toolbox version numbers.
- % VER(TBX) displays the current version information for the
- % toolbox specified by the string TBX.
-
- % Copyright (c) 1984-93 by The MathWorks, Inc.
-
- p = path;
- pathsep = ':';
- filesep = '/';
- c = computer;
- sys = 'u';
- if strcmp(c(1:2),'PC')
- pathsep = ';';
- filesep = '\';
- sys = 'p';
- elseif strcmp(c(1:2),'MA')
- pathsep = ';';
- filesep = ':';
- sys = 'm';
- elseif ~isunix % VMS
- pathsep = ',';
- filesep = '.';
- sys = 'v';
- end
- seps = find(p == pathsep);
- first = [1 seps+1];
- last = [seps-1 length(p)];
- n = length(first);
- if nargin > 0
- larg = length(arg);
- if strcmp('matlab',lower(deblank(arg)))
- disp(['MATLAB Version ',version]);
- if sys == 'v' | sys == 'u'
- disp(['MATLAB Server Hostid: ',hostid])
- end
- disp(['MATLAB Site Identification Number: ',siteid]);
- return
- end
- for i=1:n
- pp = p(first(i):last(i));
- lp = length(pp);
- if lp >= larg
- if strcmp(arg,pp(lp-larg+1:lp))
- file = [pp filesep 'Contents.m'];
- if exist(file) == 2
- c = computer;
- if c(1:2) == 'PC'
- fp = fopen(file,'rb');
- else
- fp = fopen(file,'r');
- end
- s = [fgetl(fp) ' '];
- s1 = [fgetl(fp) ' '];
- s(1:2) = [];
- s1(1:2) = [];
- disp([s ' ' s1])
- fclose(fp);
- else
- disp(['No Contents.m file for ' pp])
- end
- end
- end
- end
- return
- end
- % before we do this, we want to strip off the MATLAB portion of the
- % path because we don't want to see all the separate Contents.m files
- % for the MATLAB toolbox --- at the moment, there are 20 MATLAB directories.
- disp(['MATLAB Version ',version]);
- if sys == 'v' | sys == 'u'
- disp(['MATLAB Server Hostid: ',hostid])
- end
- disp(['MATLAB Site Identification Number: ',siteid]);
- for i=1:n
- pp = p(first(i):last(i));
- % don't do ones with toolbox/matlab/*
- % or toolbox/local (or PC, VMS, or MAC equivs)
- % peel apart name
- mlorloc = 0;
- % find fileseps within this
- filind = find(pp == filesep);
- filind = [0 ; filind(:)];
- nsep = length(filind);
- if nsep == 1
- mlorloc = strcmp('local',lower(pp)); % special VMS case, I think
- else
- % check for toolbox/local last
- last2 = pp(filind(nsep-1)+1:length(pp));
- loc = strcmp(lower(last2),['toolbox' filesep 'local']);
- ml = 0;
- if nsep > 2
- last3 = pp(filind(nsep-2)+1:filind(nsep)-1);
- ml = strcmp(lower(last3),['toolbox' filesep 'matlab']);
- end
- mlorloc = ml | loc;
- end
- % find file separators
- if ~mlorloc % not toolbox/matlab/ or local
- file = [pp filesep 'Contents.m'];
- if exist(file) == 2
- c = computer;
- if c(1:2) == 'PC'
- fp = fopen(file,'rb');
- else
- fp = fopen(file,'r');
- end
- s = [fgetl(fp) ' '];
- s1 = [fgetl(fp) ' '];
- s(1:2) = [];
- s1(1:2) = [];
- disp([s ' ' s1])
- fclose(fp);
- else
- disp(['No Contents.m file for ' pp])
- end
- end
- end
-