How to preallocate an array of class in MATLAB?
        Posted  
        
            by Kamran Bigdely Shamloo
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Kamran Bigdely Shamloo
        
        
        
        Published on 2010-03-24T18:33:42Z
        Indexed on 
            2010/03/24
            18:43 UTC
        
        
        Read the original article
        Hit count: 346
        
I have an array of objects in MATLAB and I've called their constructors in a loop:
antsNumber  = 5;
for counter = 1: antsNumber
    ant(counter) = TAnt(source, target);
end
MATLAB warns me to use preallocation to speed up the process. I do know the benefits of preallocation but I don't know how to do that for objects.
© Stack Overflow or respective owner