程序代码分析?

时间:2026-02-14 08:44:27

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

end

drawnow

ix,起始点为1,终点为500,步进默认为1。

for,循环。

程序代码分析?

程序代码分析?

4、% Get and save property values

for 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 loop

for ix=1:500

   set(h(ix),'Position',p(ix,:));

end

drawnow

© 2026 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com