MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何在MATLAB中预分配类的数组? (https://www.labfans.com/bbs/showthread.php?t=23242)

poster 2019-12-10 20:30

如何在MATLAB中预分配类的数组?
 
我在MATLAB中有一个对象数组,并在一个循环中调用了它们的构造函数:

antsNumber = 5; for counter = 1: antsNumber ant(counter) = TAnt(source, target); end MATLAB警告我使用预分配来加快过程。我确实知道预分配的好处,但是我不知道如何对对象执行此操作。



[B]回答:[/B]

以下链接可能会有所帮助:

[url]http://www.mathworks.com/help/techdoc/matlab_oop/brd4btr.html#brd4nrh[/url]
[URL="http://web.archive.org/web/20120607061119/http://www.mathworks.com/help/techdoc/matlab_oop/brd4btr.html"]无效链接的网络存档[/URL]

新连结:
[URL]http://de.mathworks.com/help/matlab/matlab_oop/creating-object-arrays.html[/URL]



[url=https://stackoverflow.com/questions/2510427]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 02:58

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.