poster
2019-12-10, 20:30
我在MATLAB中有一个对象数组,并在一个循环中调用了它们的构造函数:
antsNumber = 5; for counter = 1: antsNumber ant(counter) = TAnt(source, target); end MATLAB警告我使用预分配来加快过程。我确实知道预分配的好处,但是我不知道如何对对象执行此操作。
回答:
以下链接可能会有所帮助:
http://www.mathworks.com/help/techdoc/matlab_oop/brd4btr.html#brd4nrh
无效链接的网络存档 (http://web.archive.org/web/20120607061119/http://www.mathworks.com/help/techdoc/matlab_oop/brd4btr.html)
新连结:
http://de.mathworks.com/help/matlab/matlab_oop/creating-object-arrays.html
更多&回答... (https://stackoverflow.com/questions/2510427)
antsNumber = 5; for counter = 1: antsNumber ant(counter) = TAnt(source, target); end MATLAB警告我使用预分配来加快过程。我确实知道预分配的好处,但是我不知道如何对对象执行此操作。
回答:
以下链接可能会有所帮助:
http://www.mathworks.com/help/techdoc/matlab_oop/brd4btr.html#brd4nrh
无效链接的网络存档 (http://web.archive.org/web/20120607061119/http://www.mathworks.com/help/techdoc/matlab_oop/brd4btr.html)
新连结:
http://de.mathworks.com/help/matlab/matlab_oop/creating-object-arrays.html
更多&回答... (https://stackoverflow.com/questions/2510427)