nthlist.m

来自「% Atomizer Main Directory, Version .802 」· M 代码 · 共 28 行

M
28
字号
function item = NthList(list, pos)
% Nthlist -- find the nth argument in a list data structure
%  Usage
%	item = NthList(list, pos)
%  Inputs
%	list	the list data structure
%	pos	integer, the nth
%  Outputs
%	item	the data if the pos'th of the list
%  See Also
%	MakeList, LengthList
%

if LengthList(list) == 1,
	item = list;
else
	if isstr(list),
		ind = 1:length(list);
		ends = [0 ind(list == ' ')];
		item = list((ends(pos)+1):(ends(pos+1)-1));
	else
		ind = 1:length(list);
		ends = [0 ind(list == inf)];
		item = list((ends(pos)+1):(ends(pos+1)-1));
	end
end

⌨️ 快捷键说明

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