当前位置:编程学习 > Matlab >>

MATLAB高手,请问谁能帮忙解释以下程序的含义,谢谢!

% EDGE4CONNECTED Creates edges where each node % is connected to its four adjacent neighbors on a % height x width grid. % E - a vector in which each row i represents an edge E(i,1) --> E(i,2). % The edges are listed is in the following neighbor order: % down,up,right,left, where nodes indices are taken column-major. function E = edges4connected(height,width) N = height*width; I = []; J = []; % connect vertically (down, then up) is = [1:N]'; is([height:height:N])=[]; js = is+1; I = [I;is;js]; J = [J;js;is]; % connect horizontally (right, then left) is = [1:N-height]'; js = is+height; I = [I;is;js]; J = [J;js;is]; E = [I,J]; end PS:is = [1:N]'; is([height:height:N])=[]; I = [I;is;js];都是什么意思啊?
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,