程序代码分析
1、h = gobjects(1,500);通过这个函数可以生成的数组矩阵。共有1行,500列。
2、p = zeros(500,3);生成500行,3列这样的一个0矩阵。
3、for ix = 1:500 h(ix) = text(ix/500,ix/500,num2str(ix));enddrawnowix,起始点为1,终点为500,步进默认为1。for,循环。
4、% Get and save property valuesfor ix=1砜实蛰斓:500 pos = get(h(ix),媪青怍牙'Position'); ext = get(h(ix),'Extent'); p(ix,:) = [pos(1)+(ext(3)+ext(1)), ... pos(2)+ext(2)+ext(4),0];end%v=get(h,propertyName)返回特定属性propertyName的值。在属性名周围使用单引号,例如get(h,'Color')。如果不指定输出参数,则MATLAB将在屏幕上显示信息。
5、% Set the property values and% call a drawnow after the loopfor ix=1:500 set(h(ix),'Position',p(ix,:));enddrawnow
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。