题目
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];都是什么意思啊?
% 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];都是什么意思啊?
提问时间:2021-03-29
答案
你运行一下相信你就知道他是什么意思了
N=13;
height=2;
is=[1:N]'
is([height:height:N])=[]%删除is矩阵中部分元素
js=is+1
I=[]
I=[I;is;js]
N=13;
height=2;
is=[1:N]'
is([height:height:N])=[]%删除is矩阵中部分元素
js=is+1
I=[]
I=[I;is;js]
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
- 1He is a______my plan.He has his own plan.A后填什么
- 2一个多边形的内角和等于它的外角和的3倍,则它是几边形( ) A.八边形 B.七边形 C.六边形 D.九边形
- 3树荫下通过小孔成像可以看到圆形的光斑,是太阳发出的,这个“小孔”指的是?为什么光斑不和太阳一样大
- 4What does Mary think of playing the piano翻译
- 5每辆卡车0.3吨,有20吨货,如果一次运完要()辆卡车?
- 6甲、乙两车各行一段路,它们走的时间比是3:4,速度比是4:5,甲、乙两车所走的路程比是多少?
- 7小颖在上午8:20步行出发去森林公园郊游,
- 8杨柳小学有一圆形游泳池,底面直径是16米,池深1.5米.(1)这个游泳池的占地面积是多少?(2)
- 9孙子兵法的核心军事思想是什么
- 10英语音标的辅音.是怎样分清辅音浊辅音?
热门考点
- 1含盐量计算
- 2Tom wants very much ( )a movie括号中填to see ,seeing,sees,还是see?
- 37.When we saw his face,we knew ( )was bad 选择
- 4[(x^2-2x+1)/(x^2+5x-6)]+[(x^2+3x-11)/(x+6)]
- 5"这是一张身份证"用英语怎么说
- 6谁知道英国作家波尔克的名言 读书而不思考
- 7什么是焓?焓与能量有什么区别?有什么关系?
- 8《穷人》一课,桑娜把孩子抱回家之前和之后是怎么想的
- 9我们的日常生活中有很多事例应用了大气压的知识,例如:抽水机利用大气压把水从低处抽到高处.请你仿照示例另举出有关大气压应用的实例. a._. b._.
- 10最大的诺言是什么成语?