insert.m

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

M
19
字号
function ar = insert(ls,dat,n)
%ar=insert(ar,en,n)
%This routine will insert the entry 'en', into the array 'ar' at 
%position 'n'. 
%
%Author: Ajit S. Bopardikar
%Copyright (c) 1998 by Addison Wesley Longman, Inc.
%

 len = length(ls); %length of the input
 
 if (n<=len)  %If the data needs to be inserted somewhere in the middle of the 
             %input list
   ar = [ls(1:n-1) dat ls(n:len)]; %insertion @ position n
 else        %If the data needs to be inserted somewhere after the end of the 
             %input list
   ar = ls;
   ar(n) = dat;
 end  %endif

⌨️ 快捷键说明

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