How to initialize a vector of class handles?

前端 未结 3 2031
渐次进展
渐次进展 2021-01-14 05:04

I have a handle-based class that I need to create a vector of. An easy method of doing this is to dynamically construct the vector in a for loop, but this causes mlint

3条回答
  •  醉话见心
    2021-01-14 05:57

    Seems you can do this by a call to the empty method that is present in all non-abstract classes.

    foo = HandleClass.empty(10,0);
    for i = 1:10
        foo(i) = HandleClass();
    end
    

提交回复
热议问题