llength.m

来自「matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译」· M 代码 · 共 31 行

M
31
字号
function len=llength(x,y)%LLENGTH Length of a line.%%        LLENGTH(X,Y) return the length of the line %        described by X and Y.%        The length is calculated as the sum of the%        distances between two consecutive points.%        %        Claudio 6 September 1994.%%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu,    mark@alice.uoregon.edu%n=length(x);if n ~= length(y)  error('Vectors must be the same lengths.')endxi  = x(1:n-1);xii = x(2:n);yi  = y(1:n-1);yii = y(2:n); len = sum(sqrt((xi-xii).^2 + (yi-yii).^2)); return;

⌨️ 快捷键说明

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