⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 which1s.m

📁 一个研究声多普勒计程仪很好的工具箱
💻 M
字号:
function theResult = which1s(theFunction)

% which1s -- "which" for entire Matlab path.
%  which1s('theFunction') performs "which" for
%   all parts of the Matlab path, returning a
%   list of instances of 'theFunction', the
%   first of which is the current one.  The
%   routine ignores class-methods.
%  which1s (no argument) demonstrates itself
%   by operating on itself.
 
% Copyright (C) 2000 Dr. Charles R. Denham, ZYDECO.
%  All Rights Reserved.
%   Disclosure without explicit written consent from the
%    copyright owner does not constitute publication.
 
% Version of 29-Mar-2000 09:31:12.
% Updated    29-Mar-2000 10:08:39.

if nargin < 1& nargout < 1
	help(mfilename)
	feval(mfilename, mfilename)
	return
end

current = which(theFunction);

if isempty(current)   % Not found.
	w = {[theFunction ' not found.']};
else   % Find others.
	p = path;
	if p(1) ~= pathsep, p = [pathsep p]; end
	if p(end) ~= pathsep, p(end+1) = pathsep; end
	f = find(p == pathsep);
	w = cell(length(f-1), 1);
	w{1} = current;
	theOldPWD = pwd;
	for i = 2:length(f)
		w{i} = '';
		theDir = p(f(i-1)+1:f(i)-1);
		if ~isempty(theDir)
			cd(theDir)
			w{i} = which(theFunction);
		end
	end
	cd(theOldPWD)
end

% Delete duplicates.

[w, indices] = sort(w);
for i = length(w):-1:2
	if isequal(w{i}, w{i-1})
		w{i} = '';
	end
end
w(indices) = w;

for i = length(w):-1:2
	if isempty(w{i})
		w(i) = [];
	end
end

if nargout > 0
	theResult = w;
else
	for i = 1:length(w)
		disp(w{i})
	end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -