drop.m

来自「这是伯克里wavelet transforms一书中的例子的代码」· M 代码 · 共 20 行

M
20
字号
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 + =
减小字号Ctrl + -
显示快捷键?