📄 drop.m
字号:
function ar = drop(ls,n)
%ls1 = drop(ls,n)
%this routine will remove the 'n'th entry of the input list 'ls' and
%return the result.
%
%Author: Ajit S. Bopardikar
%Copyright (c) 1998 by Addison Wesley Longman, Inc.
%
len = length(ls); %determines the length of the input
if(n<len) %if n acceses an entry within the list
ar = [ ls(1:n-1) ls(n+1:len)];
elseif (n == len)
ar = ls(1:n-1);
else %if an element outside the input list
fprintf('Error:Index n exceeds the array length\n');
end %endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -