Possible Duplicate:
How to preallocate an array of class in MATLAB?
I have a matlab code that create an array of objects of class X. X receives a single parameters: an integer.
The array of Xs is created from an array of indexes. Today I'm doing something like this:
for i=1:length(integer_array)
integer = integer_array(i);
cur_x = X(integer)
x_arr = [x_arr cur_x];
end
Is there a more efficient way of doing this in Matlab?
Thanks