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).

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 03:30:33
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).
x[OAǿyilu )D/ac ZMaٝv.3ԪO"r1Ĩc(CL4ev_ٝ)Ko̜9f*{wov'~s?]|X򎷽r{g?Zi}>8r?G&Qadķf# Z(L,0wH lp )\ 8< %>QHD`"*aQ$h 00Ta]0Hzk$h;Li?Mҳ**5NLHn)E^.qh &Pf!6-Z#ZVsPkRP0Mb8i6ʔIbuJ3R-!煗^:&4Uѩxz/OZ}x;\hͭfne+N6;^s&l];Fk{c;} w4/w6uS-)i*rJtbfAwyymS=l|DEHwl߭$7֟f

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).
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];都是什么意思啊?

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).
你运行一下相信你就知道他是什么意思了
N=13;
height=2;
is=[1:N]'
is([height:height:N])=[]%删除is矩阵中部分元素
js=is+1
I=[]
I=[I;is;js]